Part Number Hot Search : 
PMD4002K CNY75CX OBN01016 E000655 RF2420 AD827 WM859906 BZX84C4
Product Description
Full Text Search
 

To Download TMP91FU62FG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 16 Bit Microcontroller
TLCS-900/L1 Series
TMP91FU62FG TMP91FU62DFG
Revision 1.1
TOSHIBA CORPORATION
The information contained herein is subject to change without notice. TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the "Handling Guide for Semiconductor Devices," or "TOSHIBA Semiconductor Reliability Handbook" etc. The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunction or failure of which may cause loss of human life or bodily injury ("Unintended Usage"). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's own risk. The products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of TOSHIBA or others. Please contact your sales representative for product-by-product details in this document regarding RoHS comaptibility. Please use these products in this document in compliance with all applicable laws and regulations that regulate ths inclusion or use of controlled substances. Toshiba assumes no liability for damage or losses occurring as a result of noncompliance with applicable laws and regulations.
(c) 2007 TOSHIBA CORPORATION All Rights Reserved
TMP91FU62
Revision History Date
2007/01/18
Revision
0.2 TENTATIVE Table 1-1 Pin Names and Functions WAIT pin deletion. HV-monitor EMU0 P00-P07 large-current port 2.1 RESET 10 system clocks 16us 1us 2.3.4 Prescaler Clock Controller Table 4-1 Port Functions Table 4-2 I/O Port Setting List 4.3 Port3 (P30 to P33) Deleted The input function of wait control(WAIT) Deleted Note2. P40 to P43 function Table. 4.9.1 Port 90 (TXD0/RXD0), 93 (TXD1/RXD0) 4.9.2 Port91(RXD0/TXD0), 94 (RXD1/TXD1) PB0 to PB2 function Table. 4.12 Open-drain Control 4.13 Serial channel pin change Control 14.1 Absolute Maximum Ratings Table 2-7 Source of Halt State Clearance and Halt Clearance Operation Table 4-2 I/O Port Setting List (Port B) 4.1 Port 0 (P00 to P07) 4.2 Port 1 (P10 to P17) 4.4 Port 4 (P40 to P43) Figure 4-12 Port72 4.13 Serial channel pin change/ Open-drain output Control Table 6-1 Registers and Pins for TMRB 9. 10-bit AD Converter (ADC) VREFH AVCC
2007/04/27
0.4
Figure 9-4 Analog Input Voltage and AD Conversion Result (Typ.) 13.6.10 Programming the Flash Memory by the Internal CPU Read Values in Product ID Mode Example: Program to be loaded and executed in RAM 14.2 DC Electrical Characteristics Low-level output current 14.3 AD Conversion Characteristics Deleted Analog current for analog reference voltage 15.Table of SFR's Deleted P4FC register
TMP91FU62
Date
2007/06/07
Revision
0.5 14.1 Absolute Maximum Ratings IOL, IOH is corrected 14.2 DC Electrical Characteristics ICC, IDDP-P is corrected
2007/8/27
1.0
DMAR register (89H) is corrected by RWM prohibition. 17.2 Points of note j. Releasing the HALT mode by requesting an interruption is deleted. 2.3.2 Note3 is added 7.2.1 Plescaler is corrected, and Table 7-2 is corrected 7.3 Note2 and Note3 are added 17.2 Points of note j.Clocks for serial channels (SIO)is added 6.3 SFR 15. Table of SFR's TB0FFCR, TB1FFCR, TB2FFCR and TB3FFCR register is corrected.
2007/10/10
1.1
TMP91FU62
CMOS 16 Bit Microcontroller
TMP91FU62FG/DFG
Product No. TMP91FU62FG 96K bytes TMP91FU62DFG 4K bytes QFP80-P-1420-0.80B ROM (Flash ROM) RAM Package LQFP80-P-1212-0.50E
1.1 Features
* High-speed 16-bit CPU (900/L1 CPU) - Instruction mnemonics are upward-compatible with TLCS-900,900/H,900/L - 16 Mbytes of linear address space - General-purpose registers and register banks - 16-bit multiplication and division instructions; bit transfer and arithmetic instructions - Micro DMA: 4 channels (800ns/2 bytes at 20MHz) * Minimum instruction execution time:200ns (at 20MHz) * Built-in memory - ROM: 96K bytes (Flash ROM) - RAM: 4K bytes * 8-bit timers: 4 channels * 16-bit timers: 4 channels * General-purpose serial interface: 4 channels - UART/Synchronous mode: 3 channels - I2C bus mode: 1 channels * 10-bit AD converter (Built-in Sample hold circuit): 16 channels * Special timer for CLOCK * Watchdog timer * Program patch logic: 6 banks
This product uses the Super Flash(R) technology under the licence of Silicon Storage Technology, Inc. Super Flash(R) is registered trademark of Silicon Storage Technology, Inc.
20070701-EN
* The information contained herein is subject to change without notice. * TOSHIBA is continually working to improve the quality and reliability of its products. Nevertheless, semiconductor devices in general can malfunction or fail due to their inherent electrical sensitivity and vulnerability to physical stress. It is the responsibility of the buyer, when utilizing TOSHIBA products, to comply with the standards of safety in making a safe design for the entire system, and to avoid situations in which a malfunction or failure of such TOSHIBA products could cause loss of human life, bodily injury or damage to property. In developing your designs, please ensure that TOSHIBA products are used within specified operating ranges as set forth in the most recent TOSHIBA products specifications. Also, please keep in mind the precautions and conditions set forth in the "Handling Guide for Semiconductor Devices," or "TOSHIBA Semiconductor Reliability Handbook" etc. * The TOSHIBA products listed in this document are intended for usage in general electronics applications (computer, personal equipment, office equipment, measuring equipment, industrial robotics, domestic appliances, etc.). These TOSHIBA products are neither intended nor warranted for usage in equipment that requires extraordinarily high quality and/or reliability or a malfunctionor failure of which may cause loss of human life or bodily injury ("Unintended Usage"). Unintended Usage include atomic energy control instruments, airplane or spaceship instruments, transportation instruments, traffic signal instruments, combustion control instruments, medical instruments, all types of safety devices, etc. Unintended Usage of TOSHIBA products listed in this document shall be made at the customer's own risk. * The products described in this document shall not be used or embedded to any downstream products of which manufacture, use and/or sale are prohibited under any applicable laws and regulations. * The information contained herein is presented only as a guide for the applications of our products. No responsibility is assumed by TOSHIBA for any infringements of patents or other rights of the third parties which may result from its use. No license is granted by implication or otherwise under any patents or other rights of TOSHIBA or the third parties. * Please contact your sales representative for product-by-product details in this document regarding RoHS compatibility. Please use these products in this document in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances. Toshiba assumes no liability for damage or losses occuuring as a result of noncompliance with applicable laws and regulations.
Page 1
2007-10-10
TMP91FU62
* Interrupts: 48 interrupts - 9 CPU interrupts: Software interrupt instruction and illegal instruction - 30 internal interrupts: 7 priority levels are selectable - 9 external interrupts: 7 priority levels are selectable (among 1 interrupts are selectable edge mode) * Input/output ports: 69 pins * Standby function: Three HALT modes: IDLE2 (Programmable), IDLE1 and STOP * Clock controller - Clock gear function: Select a High-frequency clock fc/1 to fc/16 - Oscillator for CLOCK (fs = 32.768 kHz) * Operating voltage Flash read operation > Vcc=4.5 V - 5.5 V (fc max = 20MHz) Flash write/erase operation > Vcc=4.75 V - 5.25 V (fc max = 20MHz) * Package - LQFP80-P-1212-0.50E (TMP91FU62FG) - QFP80-P-1420-0.80B (TMP91FU62DFG)
Page 2
2007-10-10
TMP91FU62
1.2 Pin Assignment Diagram
P67/AN15 P66/AN14 P65/AN13 P64/AN12 P63/AN11 P62/AN10 P61/AN9 P60/AN8 P57/AN7 P56/AN6 P55/AN5 P54/AN4 P53/AN3 P52/AN2 P51/AN1 P50/AN0 PB2 PB1 PB0 P33/TB3OUT1
75 80 70
30
Figure 1-1 Pin Assignment(TMP91FU62FG)
AM0 DVCC X2 DVSS X1 AM1 RESET P94/RXD1/TXD1 P95/SCLK1/CTS1 P96/XT1 P97/XT2 PA0/TB2IN0/INT1 PA1/TB2IN1/INT2 PA2/TB2OUT0 PA3/TB2OUT1 P40/SCOUT P41/TXD2/RXD2 P42/RXD2/TXD2 P43/SCLK2/CTS2 EMU0
25
35
40
AVSS AVCC P70/TA0IN P71/TA1OUT P72 P73/TA4IN P74/TA5OUT P75/INT0 P80/TB0IN0/INT5 P81/TB0IN1/INT6 P82/TB0OUT0 P83/TB0OUT1 P84/TB1IN0/INT7 P85/TB1IN1/INT8 P86/TB1OUT0 P87/TB1OUT1 P90/TXD0/RXD0 P91/RXD0/TXD0 P92/SCLK0/CTS0 P93/TXD1/RXD1
1
65
60
5 55
TMP91FU62FG
10
LQFP80 TOPVIEW
15
50
45
20
P32/TB3OUT0 P31/TB3IN1/INT4/SCL0 P30/TB3IN0/INT3/SDA0 P17 P16 P15 P14 P13 P12 P11 P10 DVSS P07 P06 P05 P04 P03 P02 P01 P00
Page 3
2007-10-10
PB1 PB2 P50/AN0 P51/AN1 P52/AN2 P53/AN3 P54/AN4 P55/AN5 P56/AN6 P57/AN7 P60/AN8 P61/AN9 P62/AN10 P63/AN11 P64/AN12 P65/AN13 65 75
80
70
1
5
60
10
55
QFP80
TOPVIEW
TMP91FU62DFG
Figure 1-2 Pin Assignment(TMP91FU62DFG)
15
Page 4
20
50
P66/AN14 P67/AN15 AVSS AVCC P70/TA0IN P71/TA1OUT P72 P73/TA4IN P74/TA5OUT P75/INT0 P80/TB0IN0/INT5 P81/TB0IN1/INT6 P82/TB0OUT0 P83/TB0OUT1 P84/TB1IN0/INT7 P85/TB1IN1/INT8 P86/TB1OUT0 P87/TB1OUT1 P90/TXD0/RXD0 P91/RXD0/TXD0 P92/SCLK0/CTS0 P93/TXD1/RXD1 AM0 DVCC
45
40
PB0 P33/TB3OUT1 P32/TB3OUT0 P31/TB3IN1/INT4/SCL0 P30/TB3IN0/INT3/SDA0 P17 P16 P15 P14 P13 P12 P11 P10 DVSS P07 P06 P05 P04 P03 P02 P01 P00 EMU0 P43/SCLK2/CTS2
30 35 25
P42/RXD2/TXD2 P41/TXD2/RXD2 P40/SCOUT PA3/TB2OUT1 PA2/TB2OUT0 PA1/TB2IN1/INT2 PA0/TB2IN0/INT1 P97/XT2 P96/XT1 P95/SCLK1/CTS1 P94/RXD1/TXD1 RESET AM1 X1 DVSS X2
TMP91FU62
2007-10-10
TMP91FU62
1.3 Block Diagram
Figure 1-3 Block Diagram
Page 5
2007-10-10
TMP91FU62
1.4 Pin Names and Functions
Table 1-1 Pin Names and Functions(1/3)
Input / Output IO IO IO I I IO IO I I IO IO O IO O IO O IO O I IO I O IO IO I IO I IO I IO I IO O IO IO I IO O IO I IO I I
Pin Name
Pin Number
Functions
P00-P07 P10-P17 P30 TB3IN0 INT3 SDA0 P31 TB3IN1 INT4 SCL0 P32 TB3OUT0 P33 TB3OUT1 P40 SCOUT P41 TXD2 RXD2 P42 RXD2 TXD2 P43 SCLK2 CTS2 P50-57 AN0-AN7 P60-67 AN8-AN15 P70 TA0IN P71 TA1OUT P72 P73 TA4IN P74 TA5OUT P75 INT0 P80 TB0IN0 INT5
8 8
Port 0: I/O port that allows I/O to be selected at the bit level (large-current port) Port 1: I/O port that allows I/O to be selected at the bit level Port 30: I/O port 16-bit timer 3 input 0:Timer B3 count/capture trigger Input 0 Interrupt Request Pin 3: Interrupt request pin with programmable rising edge / falling edge. Serial bus interface data 0 in I2C bus Mode. Port 31: I/O port 16-bit timer 3 input 1:Timer B3 count/capture trigger Input 1 Interrupt Request Pin 4: Interrupt request on rising edge Serial bus interface clock 0 in I2C bus Mode. Port 32: I/O port 16-bit timer 3 output 0: Timer B3 Output 0 Port 33: I/O port 16-bit timer 3 output 1: Timer B3 Output 1 Port 40: I/O port (with pull-up resistor) System Clock Output: Outputs fSYS or fs clock. Port 41: I/O port (with pull-up resistor) Serial Send Data 2 Serial Receive Data 2 Port 42: I/O port (with pull-up resistor) Serial Receive Data 2 Serial Send Data 2 Port 43: I/O port (with pull-up resistor) Serial Clock I/O 2 Serial Data Send Enable 2 (Clear to Send) Port 5: I/O port Analog input: Pin used to input to AD converter Port 6: I/O port Analog input: Pin used to input to AD converter Port 70: I/O port 8-bit timer 0 input: Timer A0 Input Port 71: I/O port 8-bit timer 1 output:Timer A1 Output Port 72: I/O port Port 73: I/O port 8-bit timer 4 input: Timer A4 Input Port 74: I/O port 8-bit timer 5 output:Timer A5 Output Port 75: I/O port Interrupt Request Pin 0: Interrupt request pin with programmable level / rising edge / falling edge. Port 80: I/O port 16-bit timer 0 input 0:Timer B0 count/capture trigger Input 0 Interrupt Request Pin 5: Interrupt request pin with programmable rising edge / falling edge.
1
1
1
1
1
1
1
1
8
8
1
1
1
1
1
1
1
Page 6
2007-10-10
TMP91FU62
Table 1-1 Pin Names and Functions(2/3)
Input / Output IO I I IO O IO O IO I I IO I I IO O IO O IO O I IO I O IO IO I IO O I IO I O IO IO I IO I IO O IO I I IO I I IO O IO O
Pin Name
Pin Number
Functions
P81 TB0IN1 INT6 P82 TB0OUT0 P83 TB0OUT1 P84 TB1IN0 INT7 P85 TB1IN1 INT8 P86 TB1OUT0 P87 TB1OUT1 P90 TXD0 RXD0 P91 RXD0 TXD0 P92 SCLK0 CTS0 P93 TXD1 RXD1 P94 RXD1 TXD1 P95 SCLK1 CTS1 P96 XT1 P97 XT2 PA0 TB2IN0 INT1 PA1 TB2IN1 INT2 PA2 TB2OUT0 PA3 TB2OUT1
1
Port 81: I/O port 16-bit timer 0 input 1:Timer B0 count/capture trigger Input 1 Interrupt Request Pin 6: Interrupt request on rising edge Port 82: I/O port 16-bit timer 0 output 0: Timer B0 Output 0 Port 83: I/O port 16-bit timer 0 output 1: Timer B0 Output 1 Port 84: I/O port 16-bit timer 1 input 0:Timer B1 count/capture trigger Input 0 Interrupt Request Pin 7: Interrupt request pin with programmable rising edge / falling edge. Port 85: I/O port 16-bit timer 1 input 1:Timer B1 count/capture trigger Input 1 Interrupt Request Pin 8: Interrupt request on rising edge Port 86: I/O port 16-bit timer 1 output 0: Timer B1 Output 0 Port 87: I/O port 16-bit timer 1 output 1: Timer B1 Output 1 Port 90: I/O port Serial Send Data 0 Serial Receive Data 0 Port 91: I/O port Serial Receive Data 0 Serial Send Data 0 Port 92: I/O port Serial Clock I/O 0 Serial Data Send Enable 0 (Clear to Send) Port 93: I/O port Serial Send Data 1 Serial Receive Data 1 Port 94: I/O port Serial Receive Data 1 Serial Send Data 1 Port 95: I/O port Serial Clock I/O 1 Serial Data Send Enable 1 (Clear to Send) Port 96: I/O port Low-frequency oscillator connection pin Port 97: I/O port Low-frequency oscillator connection pin Port A0: I/O port 16-bit timer 2 input 0:Timer B2 count/capture trigger Input 0 Interrupt Request Pin 1: Interrupt request pin with programmable rising edge / falling edge. Port A1: I/O port 16-bit timer 2 input 1:Timer B2 count/capture trigger Input 1 Interrupt Request Pin 2: Interrupt request on rising edge Port A2: I/O port 16-bit timer 2 output 0: Timer B2 Output 0 Port A3: I/O port 16-bit timer 2 output 1: Timer B2 Output 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Page 7
2007-10-10
TMP91FU62
Table 1-1 Pin Names and Functions(3/3)
Input / Output IO
Pin Name
Pin Number
Functions
PB0-PB2
3
Port B: I/O port that allows I/O to be selected at the bit level Operation mode:Fixed to AM1 "1", AM0 "1". Single Boot mode:Fixed to AM1 "0", AM0 "1". Programmer mode:Fixed to AM1 "1", AM0 "0". Open pin Reset: initializes TMP91FU62. (with pull-up resistor) Power supply pin for AD converter GND pin for AD converter (0 V)
AM0-1
2
I
EMU0 RESET AVCC AVSS X1/X2 DVCC DVSS
1 1 1 1 2 3 3
O I
IO
High frequency oscillator connection pins Power supply pins (All DVCC pins should be connected with the power supply pin.) GND pins (0 V) (All DVSS pins should be connected with the GND (0V) pin.)
Note: All pins that have built-in pull-up resistors (other than the RESET pin) can be disconnected from the built-in pull-up resistor by software.
Page 8
2007-10-10
TMP91FU62
2. CPU
The TMP91FU62 incorporates a high-performance 16-bit CPU (The 900/L1-CPU). For CPU operation, see the "TLCS-900/L1 CPU". The following describe the unique function of the CPU used in the TMP91FU62; these functions are not covered in the TLCS-900/L1 CPU section.
2.1 RESET
When resetting the TMP91FU62 microcontroller, ensure that the power supply voltage is within the operating voltage range, and that the internal high-frequency oscillator has stabilized. Then hold the RESET input to low level at least for 10 system clocks (1us at 20 MHz). Thus, when turn on the switch, be set to the power supply voltage is within the operating voltage range, and that the internal high-frequency oscillator has stabilized. Then hold the RESET input to Low level at least for 10 system clocks. It means that the system clock mode fSYS is set to fc/2. When the reset is accept, the CPU: 1. Sets as follows the program counter (PC) in accordance with the reset vector stored at address FFFF00H to FFFF02H: - PC (7:0) - PC (15:8) <- Value at FFFF00H address <- Value at FFFF01H address
- PC (23:16) <- Value at FFFF02H address 2. Sets the stack pointer (XSP) to 100H. 3. Sets bits of the status register (SR) to 111 (Sets the interrupt level mask register to level 7). 4. Sets the bit of the status register (SR) to 1 (MAX mode). 5. Clears bits of the status register (SR) to 000 (Sets the register bank to 0). When reset is released, the CPU starts executing instructions in accordance with the program counter settings. CPU internal registers not mentioned above do not change when the reset is released. When the reset is accepted, the CPU sets internal I/O, ports, and other pins as follows. 1. Initializes the internal I/O registers. 2. Sets the port pins, including the pins that also act as internal I/O, to general-purpose input or output port mode. 3. Sets ALE pin to high impedance.
Note 1: The CPU internal register (except to PC, SR, XSP in CPU) and internal RAM data do not change by resetting. Note 2: It is necessary to re-set up a stack pointer XSP by the user program.
Figure 2-1 is a reset timing chart of the TMP91FU62.
Page 9
2007-10-10
fFPH
Sampling Sampling
RESET
Figure 2-1 TMP91FU62 Reset Timing Chart
Page 10
(input mode) (input mode)
P40~P43
P00 P30 P60 P80 PA0
P07, P10 P33, P50 P67, P70 P87, P90 PA3, PB0
P17 P57 P75 P97 PB2
TMP91FU62
2007-10-10
TMP91FU62
2.2 Memory Map
Figure 2-2 is a memory map of the TMP91FU62.
000000H
Internal I/O (4 Kbytes)
(n)
000100H 001000H Internal RAM (4 Kbytes)
64 Kbyte area (nn)
002000H 010000H
FE8000H
96 Kbyte
16-Mbyte area (R) (-R) (R+) (R + R8/16) (R + d8/16) (nnn)
FFFF00H FFFFFFH
Figure 2-2 TMP91FU62 Memory Map
Page 11
2007-10-10
TMP91FU62
2.3 System Clock Function and Standby Control
TMP91FU62 contains a clock gear, stand-by controller and noise-reduction circuit. It is used for low-noise systems. The clock operating modes are as follows: (a) Single clock mode (X1 and X2 pins only), (b) Dual clock mode (X1,X2,XT1 and XT2 pins). Figure 2-3 shows a transition figure.
(fOSCH/2) IDLE2 mode (I/O operate) IDLE1 mode
(Operate only oscillator)
NORMAL mode (fOSCH /gear value/2)
STOP mode
(Stops All circuits)
(a) Single clock mode transition figure
(fOSCH/2) IDLE2 mode (I/O operate) IDLE1 mode
(Operate only oscillator)
NORMAL mode (fOSCH /gear value/2)
STOP mode
(Stops All circuits)
IDLE2 mode (I/O operate) IDLE1 mode
(Operate only oscillator)
SLOW mode (fs/2) (b) Dual clock mode transition figure
Figure 2-3 TMP91FU62 Clock Operating Mode
Note: The clock frequency input from the X1 and X2 pins is called fOSCH and the clock frequency input from the XT1 and XT2 pins is called fs. The clock frequency selected by SYSCR1 is called fFPH. The system clock fSYSis defined as the divided clock of fFPH, and one cycle of fSYS is regret to as one state.
Page 12
2007-10-10
TMP91FU62 2.3.1 Block Diagram of System Clock
SYSCR0 SYSCR2 Warm-up timer (for high/low frequency oscillator) SYSCR0 T0 fc/16 fFPH
/4
SYSCR0 XT1 XT2
Lowfrequency oscillator
fs fFPH fs fc fc/2 2 fc/4 fc/8
fc/16 / / / /
fSYS
SYSCR0 X1 X2
Highfrequency oscillator
SYSCR1
SYSCR1
fOSCH
fSYS TMRA01 and TMRA45 T0 Prescaler
CPU ROM RAM TMRB0 toTMRB3 Prescaler WDT I/O port SIO0 to SIO2 ADC Prescaler
SBI0 Prescaler
fs
Binary counter
SYSCR2 P40
f
Figure 2-4 Block Diagram of System Clock
Page 13
2007-10-10
TMP91FU62
2.3.2
Table 2-1
SFR
SFR for System Clock
7 Bit Symbol Read/Write After reset 1 0 1 XEN 6 XTEN 5 RXEN 4 RXTEN R/W 0 0 0 Warm-up timer control 0 Write: Don't care 1 Write: Start warmup 0 Read: End warmup 1 Read: Do not end warm-up GEAR2 R/W 0 0 0 0 0 3 RSYSCK 2 WUEF 1 PRCK1 0
- - -
SYSCR0 (00E0H) Function
Highfrequency oscillator 0:Stop 1:Oscillation
Lowfrequency oscillator 0:Stop 1:Oscillation
Highfrequency oscillator (fc) after release of STOP mode 0:Stop 1:Oscillation
Lowfrequency oscillator (fs) after release of STOP mode 0:Stop 1:Oscillation
Selects clock after release of STOP mode 0:fc 1:fs
Select prescaler clock 0:fFPH 1:fc/16
Bit Symbol Read/Write After reset
- - -
- - -
- - -
- - -
SYSCK
GEAR1
GEAR0
SYSCR1 (00E1H) Function
-
-
-
-
Select system clock 0: fc 1: fs
Select gear value of high frequency (fc) 000:fc 001:fc/2 010:fc/4 011:fc/8 100:fc/16 101:reserved 110:reserved 111:reserved HALTM0
Bit Symbol Read/Write After reset SYSCR2 (00E2H) Function
- - -
SCOSEL
WUPTM1
WUPTM0 R/W
HALTM1
- -
DRVE R/W 0 Pin state control in STOP mode 0: I/O off 1: Remains the state before HALT
0
1
0
1
1
-
-
Select SCOUT 0:fs 1:fSYS
Select warm-up time for oscillator 00:218/inputted frequency 01:28/inputted frequency 10:214/inputted frequency 11:216/inputted frequency
HALT mode 00:reserved 01:STOP mode 10:IDLE1 mode 11:IDLE2 mode
-
Note 1: "-" = Don't care Note 2: SYSCR0,SYSCR1,SYSCR2 are read as undefined value. Note 3: As for the serial channels SIO0, SIO1 and SIO2, a baud rate generator is unavailable as an input clock of an I/O interface and a clock for a serial transfer if a prescaler clock is set to fc/16 when SYSCR0 is "1".
Page 14
2007-10-10
TMP91FU62
2.3.3
System Clock Controller
The system clock controller generates the system clock signal (fSYS) for the CPU core and internal I/O.It contains two oscillation circuits and a clock gear circuit for high-frequency (fc) operation. The register SYSCR1 changes the system clock to either fc or fs, SYSCR0 and SYSCR0 control enabling and disabling of each oscillator, and SYSCR1 sets the high-frequency clock gear to either 1, 2, 4, 8 or 16 (fc, fc/2, fc/4, fc/8 or fc/16). These functions can reduce the power consumption of the equipment in which the device is installed. The combination of settings = "1", = "0", = "0" and = "000" will cause the system clock (fSYS) to be set to fc/2 (=fc x 1/2) after a Reset. For example, fSYS is set to 8 MHz when the 16 MHz oscillator connected to the X1 and X2 pins. (1) Switching from NORMAL mode to SLOW mode When the resonator is connected to the X1 and X2 pins, or to the XT1 and XT2 pins, the warm-up timer can be used to change the operation frequency after stable oscillation has been attained. The warm-up time can be selected using SYSCR2. This warm-up timer can be programmed to start and stop as shown in the following examples 1 and 2. Table 2-2 shows the warm-up time.
Note 1: When using an oscillator (other than a resonator) with stable oscillation, a warm-up timer is not needed. Note 2: The warm-up timer is operated by an oscillation clock. Hence, there may be some variation in warm-up time. Note 3: Note of using low-frequency oscillator When connect low-frequency oscillator to ports 96 and 97, need below setting for cut consumption power. (Case of resonators) Set P9CR = "11", P9 = "00" (Case of oscillator) Set P9CR = "11", P9 = "10"
Table 2-2 Warm-up Times (when changing clock)
Select Warm-up Time SYSCR2 01(28/frequency) 10(214/frequency) 11(216/frequency) 00(218/frequency) Change to NORMAL (fc) 12.8[us] 0.819[ms] 3.277[ms] 13.107[ms] Change to SLOW (fs) 7.8[ms] 500[ms] 2000[ms] 8000[ms]
Note: At fOSCH=20MHzfs=32.768kHz
Page 15
2007-10-10
TMP91FU62
Example 1: Changing from high frequency (fc) to low frequency (fs). SYSCR0 SYSCR1 SYSCR2 EQU EQU EQU LD SET SET WUP: BIT JR SET RES 00E0H 00E1H 00E2H (SYSCR2),X-11--X-B 6,(SYSCR0) 2,(SYSCR0) 2,(SYSCR0) NZ,WUP 3,(SYSCR1) 7,(SYSCR0) ; ; ; ;
Detects stopping of warm-up timer. Sets warm-up time to 216/fs. Enables low-frequency oscillation. Clears and starts warm-up timer.
; ; ;
Changes fSYS from fc to fs. Disables high-frequency oscillation.
Note: X: Don't care, -:No change
X1 and X2 pins XT1 and XT2 pins
Counts up by fSYS
Counts up by fs
fSYS
Figure 2-5 Changing from high frequency (fc) to low frequency (fs)
Page 16
2007-10-10
TMP91FU62
Example 2: Changing from low frequency (fs) to high frequency (fc).
SYSCR0 SYSCR1 SYSCR2 EQU EQU EQU LD SET SET WUP: BIT JR RES RES 00E0H 00E1H 00E2H (SYSCR2),X-10--X-B 7,(SYSCR0) 2,(SYSCR0) 2,(SYSCR0) NZ,WUP 3,(SYSCR1) 6,(SYSCR0) ; ; ; ; Detects stopping of warm-up timer. ; ; ; Changes fSYS from fs to fc Disables low-frequency oscillation. Sets warm-up time to 214/fc. Enables high-frequency oscillation. Clears and starts warm-up timer.
Note: X: Don't care, -:No change
X1 and X2 pins XT1 and XT2 pins Counts up by fSYS
Counts up by fc
fSYS
Figure 2-6 Changing from low frequency (fs) to high frequency (fc)
(2) Clock gear controller When the high-frequency clock fc is selected by setting SYSCR1 = "0", fFPH is set according to the contents of the clock gear select register SYSCR1 to either fc, fc/2, fc/4, fc/8 or fc/16. Using the clock gear to select a lower value of fFPH reduces power consumption. Below show example of changing clock gear.
Page 17
2007-10-10
TMP91FU62
Example 3: Changing to a clock gear SYSCR1 EQU LD X:Don't care (Clock gear changing) To change the clock gear, write the register value to the SYSCR1 register. It is necessary the warm-up time until changing after writing the register value. There is the possibility that the instruction next to the clock gear changing instruction is executed by the clock gear before changing. To execute the instruction next to the clock gear switching instruction by the clock gear after changing, input the dummy instruction as follows (instruction to execute the write cycle). 00E1H (SYSCR1),XXXX0000B
;
Changes fSYS to fc/2.
SYSCR1
EQU LD LD
00E1H (SYSCR1),XXXX0000B (DUMMY),00H ; ; Changes fSYS to fc/2. Dummy instruction
Instruction to be executed after clock gear has changed.
(3)Internal clock output The fSYS or fs internal clock can be driven out from the P40/SCOUT pin. The P40/SCOUT pin is configured as SCOUT (System clock output) by programming the port 4 registers as follows: P4CR = "1" and P4FC = "1". The output clock is selected through the SYSCR2 bit. Table 2-3 shows the pin states in each clocking mode when the P40/SCOUT pin is configured as SCOUT. Table 2-3 SCOUT Output States
HALT mode NORMAL SLOW IDLE2 ="0" ="1" The fs clock is driven out. The fSYS clock is driven out. IDLE1 STOP HOLD at either "1" or "0"
2.3.4
Prescaler Clock Controller
For the internal I/O (TMRA01 and TMRA45, TMRB0 to TMRB3, SIO0 to SIO2, SBI0) there is a prescaler which can divide the clock. The T0 clock input to the prescaler is either the clock fFPH divided by 2 or the clock fc/16 divided by 4. The setting of the SYSCR0 register determines which clock signal is input.
Page 18
2007-10-10
TMP91FU62
2.3.5
Runaway provision with SFR protection register
(Purpose) Provision in runaway of program by noise mixing. Write operation to specified SFR is prohibited so that provision program in runaway prevents that it is it in the state which is fetch impossibility by stopping of clock, memory control register (CS/WAIT controller) is changed.
Specified SFR list
1. Clock gear (write enable only EMCCR1) SYSCR0, SYSCR1, SYSCR2
(Block diagram)
EMCCR0
S R
Q
Write signal to SFR
(Setting method) If writing except "1FH" code to EMCCR1 register, it become protect ON. By this operation, write operation to specified SFR is disabling. If writing "1FH" to EMCCR1 register, it become protect OFF. State of protect can to confirm by reading EMCCR0. Table 2-4 SFR for EMCCR
7 Bit Symbol Read/Write EMCCR0 (00E3H) After reset PROTECT R 0 Protect flag 0: OFF 1: ON 0 1 0 6 5 4 3 2 1 0
-
-
-
-
R/W 0
-
-
-
0
1
1
Function
Write "0".
Write "1".
Write "0".
Write "0".
Write "0".
Write "1".
Write "1".
Bit Symbol EMCCR1 (00E4H) Read/Write After reset Function Protect OFF by writing "1FH". Protect ON by writing except "1FH".
Page 19
2007-10-10
TMP91FU62
2.3.6
Standby Controller
(1)HALT modes When the HALT instruction is executed, the operating mode switches to IDLE2, IDLE1 or STOP mode, depending on the contents of the SYSCR2 register. The subsequent actions performed in each mode are as follows: 1. IDLE2: Only the CPU halts. The internal I/O is available to select operation during IDLE2 mode by setting the following register. Shows the registers of setting operation during IDLE2 mode. Table 2-5 SFR Setting Operation during IDLE2 Mode
Internal I/O TMRA01 TMRA45 TMRB0 TMRB1 TMRB2 TMRB3 SFR TA01RUN TA45RUN TB0RUN TB1RUN TB2RUN TB3RUN Internal I/O SIO0 SIO1 SIO2 SBI0 AD WDT SFR SC0MOD1 SC1MOD1 SC2MOD1 SBI0BR ADCCR2 WDMOD
2. IDLE1: Only the oscillator and the RTC (Real time clock) continue to operate. 3. STOP: All internal circuits stop operating. The operation of each of the different HALT modes is described in Table 2-6. Table 2-6 I/O Operation during HALT Modes
HALT mode SYSCR2 CPU I/O port TMRA,TMRB Block RTC SIO,SBI AD Available to select operation block Operate enable IDLE2 IDLE1 STOP
11
10 Stop
01
Keep the state when the HALT instruction was executed.
See Table 2-9
Stop
WDT Interrupt controller Operate
Page 20
2007-10-10
TMP91FU62
(2)How to release the HALT mode These halt states can be released by resetting or requesting an interrupt. The halt release sources are determined by the combination between the states of interrupt mask register and the HALT modes. The details for releasing the halt status are shown in Table 2-7. Released by requesting an interrupt The operating released from the HALT mode depends on the interrupt enabled status. When the interrupt request level set before executing the HALT instruction exceeds the value of interrupt mask register, the interrupt due to the source is processed after releasing the HALT mode, and CPU status executing an instruction that follows the HALT instruction. When the interrupt request level set before executing the HALT instruction is less than the value of the interrupt mask register, releasing the HALT mode is not executed. (In non-maskable interrupts, interrupt processing is processed after releasing the HALT mode regardless of the value of the mask register.) However only for INT0 and RTC interrupts, even if the interrupt request level set before executing the HALT instruction is less than the value of the interrupt mask register, releasing the HALT mode is executed. In this case, interrupt processing, and CPU starts executing the instruction next to the HALT instruction, but the interrupt request flag is held at "1".
Note:Usually, interrupts can release all halts status. However, the interrupts (INT0, INTRTC) which can release the HALT mode may not be able to do so if they are input during the period CPU is shifting to the HALT mode (for about 5 clocks of fFPH) with IDLE1 or STOP mode (IDLE2 is not applicable to this case). (In this case, an interrupt request is kept on hold internally.) If another interrupt is generated after it has shifted to HALT mode completely, halt status can be released without difficulty. The priority of this interrupt is compared with that of the interrupt kept on hold internally, and the interrupt with higher priority is handled first followed by the other interrupt.
Releasing by resetting Releasing all halt status is executed by resetting. When the STOP mode is released by RESET, it is necessary enough resetting time (See Table 2-6)to set the operation of the oscillator to be stable. When releasing the HALT mode by resetting, the internal RAM data keeps the state before the "HALT" instruction is executed. However the other settings contents are initialized. (Releasing due to interrupts keeps the state before the "HALT" instruction is executed.)
Page 21
2007-10-10
TMP91FU62
Table 2-7 Source of Halt State Clearance and Halt Clearance Operation
Status of Received Interrupt
Interrupt Enable (Interrupt level) IDLE2
(Interrupt mask)
STOP
Interrupt Disable (Interrupt level) < (Interrupt mask) IDLE2 IDLE1 STOP -
HALT mode
INTWDT INT0(Note 1)
IDLE1
(Note 2)
x x x x x x x x
x *1 x x x x x x x x
x x x x x x x
x x x x x x x
*1 x x x x x x x x
Source of Halt state clearance
INTRTC INT1-INT8
Interrupt
INTTA0, INTTA1, INTTA4, INTTA5 INTTB00-30, INTTB01-31 INTTB0F0-3 INTRX0-INTRX2, INTTX0-INTTX2 INTSBI0 INTAD RESET
Initialize LSI
:After clearing the HALT mode, CPU starts interrupt processing. :After clearing the HALT mode, CPU resumes executing starting from instruction following the HALT instruction. (Interrupt routine don't execute.) x:It can not be used to release the HALT mode. - :The priority level (Interrupt request level) of non-maskable interrupts is fixed to 7, the highest priority level. There is not this combination type. *1:Releasing the HALT mode is executed after passing the warm-up time.
Note 1: When the HALT mode is cleared by an INT0 interrupt of the level mode in the interrupt enabled status, hold high level until starting interrupt process. If low level was set before interrupt process is stared, interrupt process is not started correctly. Note 2: If using external interrupt INT1 to INT8 in IDLE2 mode, set 16-bit timer RUN register TB0RUN, TB1RUN, TB2RUN, TB3RUN to "1".
Page 22
2007-10-10
TMP91FU62
Example:Clearing halt state An INT0 interrupt clears the halt state when the device is in IDLE1 mode.
8203H 8206H 8209H 820BH 820EH INT0
LD LD EI LD HALT
(IIMC), 00H (INTE0AD), 06H 5 (SYSCR2), 28H
; Selects INT0 interrupt rising edge. ; Sets INT0 interrupt level to 6. ; Sets CPU interrupt level to 5. ; Sets HALT mode to IDLE1 mode. ; Halts CPU. INT0 interrupt routine RETI
820FH
LD
XX, XX
(3)Operation 1. IDLE2 mode In IDLE2 mode only specific internal I/O operations, as designated by the IDLE2 setting register, can take place. Instruction execution by the CPU stops. Figure 2-7 illustrates an example of the timing for clearance of the IDLE2 mode halt state by an interrupt.
X1
A0~A23
RD
IDLE2
Figure 2-7 Timing Chart for IDLE2 Mode Halt State Cleared by Interrupt
Page 23
2007-10-10
TMP91FU62
2. IDLE1 mode In IDLE1 mode, only the internal oscillator and the RTC continue to operate. The system clock in the MCU stops. In the halt state, the interrupt request is sampled asynchronously with the system clock; however, clearance of the Halt state (e.g., restart of operation) is synchronous with it. Figure 2-8 illustrates the timing for clearance of the IDLE1 mode halt state by an interrupt.
X1
A0A23
RD
IDLE1 mode
Figure 2-8 Timing Chart for IDLE1 Mode Halt State Cleared by Interrupt
Page 24
2007-10-10
TMP91FU62
3. STOP mode When STOP mode is selected, all internal circuits stop, including the internal oscillator. Pin status in STOP mode depends on the settings in the SYSCR2 register. Table 2-9 summarizes the state of these pins in STOP mode. After STOP mode has been cleared, system clock output starts when the warm-up time has elapsed, in order to allow oscillation to stabilize. After STOP mode has been cleared, either NORMAL mode or SLOW mode can be selected using the SYSCR0 register. Therefore, , and must be set. See the sample warm-up times in Table 2-8. Figure 2-9 illustrates the timing for clearance of the STOP mode halt state by an interrupt.
X1
A0A23
RD
STOP
Figure 2-9 Timing Chart for STOP Mode Halt State Cleared by Interrupt
Table 2-8 Sample Warm-up Times after Clearance of STOP Mode SYSCR0 0(fc) 1(fs) SYSCR2 01(28) 12.8us 7.8ms 10(214) 0.819ms 500ms 11(216) 3.277ms 2000ms 00(218) 13.107ms 8000ms
Note: fOSCH=20MHz, fs=32.768kHz
Page 25
2007-10-10
TMP91FU62
Example: "The STOP mode is entered when the low-frequency operates, and high-frequency operates after releasing due to INT0.
SYSCR0 SYSCR1 SYSCR2 8FFDH 9000H 9002H 9005H
INT0
EQU EQU EQU LD LD LD HALT
00E0H 00E1H 00E2H (SYSCR1), 08H (SYSCR2), X-1001X1B (SYSCR0), 011000 - -B
; ; ;
fSYS = fs/2 214/fOSCH
INT0
9006H
LD -: No change
XX, XX
RETI
Note:When different modes are used before and after STOP mode as the above mentioned, there is possible to release the HALT mode without changing the operation mode by acceptance of the halt release interrupt request during execution of "HALT" instruction (during 6 state). In the system which accepts the interrupts during execution "HALT" instruction, set the same operation mode before and after the STOP mode.
Page 26
2007-10-10
TMP91FU62
Table 2-9 Input/output Buffer State Table Port Name
P00-07
Input / Output
input mode output mode input mode output mode input mode output mode input mode output mode input mode output mode analog input input mode output mode analog input input mode output mode input mode output mode input mode output mode input mode output mode input mode output mode input mode output mode input input input output
=0
PU* PU* input input input "H" level output
=1
output output output PU* output output output input output input output output output output output input input "H" level output
P10-17
P30-33
P40-43
P50-57
P60-67
P70-74
P75
P80-87
P90-97
PA0-A3
PB0-B2 RESET AM0,AM1 X1 X2
-:
Input for input mode / input pins is invalid; output mode / output pin is at high impedance.
input: Input gate in operation. Fix input voltage to "L" or "H" so that input pin stays constant. output: Output state PU*: Programmable pull-up pin. Input gate disable state. No through current even if the pin is set high impedance.
Page 27
2007-10-10
TMP91FU62
3. Interrupts
Interrupts are controlled by the CPU interrupt mask register SR and by the built-in interrupt controller. The TMP91FU62 has a total of 48 interrupts divided into the following three types:
* Interrupts generated by CPU: 9 sources (Software interrupts, illegal instruction interrupt) * Interrupts on external pins ( INT0 to INT8): 9 sources * Internal interrupts: 30 sources
A (fixed) individual interrupt vector number is assigned to each interrupt. One of six (Variable) priority level can be assigned to each maskable interrupt. The priority level of non-maskable interrupts are fixed at 7 as the highest level. When an interrupt is generated, the interrupt controller sends the priority of that interrupt to the CPU. If multiple interrupts are generated simultaneously, the interrupt controller sends the interrupt with the highest priority to the CPU. (The highest priority is level 7 using for non-maskable interrupts.) The CPU compares the priority level of the interrupt with the value of the CPU interrupt mask register . If the priority level of the interrupt is higher than the value of the interrupt mask register, the CPU accepts the interrupt. The interrupt mask register value can be updated using the value of the EI instruction ("EI num" sets data to num). For example, specifying "EI3" enables the maskable interrupts which priority level set in the interrupt controller is 3 or higher, and also non-maskable interrupts. Operationally, the DI instruction ( "7") is identical to the "EI7" instruction. DI instruction is used to disable maskable interrupts because of the priority level of maskable interrupts is 0 to 6. The EI instruction is valid immediately after execution. In addition to the above general-purpose interrupt processing mode, TLCS-900/L1 has a micro DMA interrupt processing mode as well. The CPU can transfer the data (1/2/4 bytes) automatically in micro DMA mode, therefore this mode is used for speed-up interrupt processing, such as transferring data to the internal or external peripheral I/ O. Moreover, TMP91FU62 has software start function for micro DMA processing request by the software not by the hardware interrupt. Figure 3-1 shows the overall interrupt processing flow.
Page 28
2007-10-10
TMP91FU62
Interrupt processing
Interrupt specified by micro DMA start vector?
Yes Micro DMA soft start request
Clear interrupt request flag
No Interrupt vector value "V" read Interrupt request F/F clear
General-purpose interrupt processing
Data transfer by micro DMA
PUSH PUSH SR INTNEST
PC SR Level of accepted interrupt + 1 INTNEST + 1
Count
Count - 1
Micro DMA processing
PC
(FFFF00H + V)
Yes
Count = 0
No
Clear vector register generating micro DMA transfer and interrupt (INTTC0 to INTTC3)
Interrupt processing program
RETI instruction POP SR POP PC INTNEST - 1 INTNEST
End
Figure 3-1 Overall Interrupt Processing Flow
Page 29
2007-10-10
TMP91FU62
3.1 General-purpose Interrupt Processing
When the CPU accepts an interrupt, it usually performs the following sequence of operations. That is also the same as TLCS-900/L and TLCS-900/H. 1. The CPU reads the interrupt vector from the interrupt controller. If the same level interrupts occur simultaneously, the interrupt controller generates an interrupt vector in accordance with the default priority and clears the interrupt request. (The default priority is already fixed for each interrupt. The smaller vector value has the higher priority level.) 2. The CPU pushes the value of program counter (PC) and status register (SR) onto the stack area (Indicated by XSP). 3. The CPU sets the value which is the priority level of the accepted interrupt plus 1 (+1) to the interrupt mask register . However, if the priority level of the accepted interrupt is 7, the register's value is set to 7. 4. The CPU increases the interrupt nesting counter INTNEST by 1 (+1). 5. The CPU jumps to the address indicated by the data at address "FFFF00H + Interrupt vector" and starts the interrupt processing routine. The above processing time is 18 states (1.8 s at 20 MHz) as the best case (16-bit data bus width and 0 waits). When the CPU completed the interrupt processing, use the RETI instruction to return to the main routine. RETI restores the contents of program counter (PC) and status register (SR) from the stack and decreases the interrupt nesting counter INTNEST by 1 (-1). Non-maskable interrupts cannot be disabled by a user program. Maskable interrupts, however, can be enabled or disabled by a user program. A program can set the priority level for each interrupt source. (A priority level setting of 0 or 7 will disable an interrupt request.) If an interrupt request which has a priority level equal to or greater than the value of the CPU interrupt mask register comes out, the CPU accepts its interrupt. Then, the CPU interrupt mask register is set to the value of the priority level for the accepted interrupt plus 1 (+1). Therefore, if an interrupt is generated with a higher level than the current interrupt during its processing, the CPU accepts the later interrupt and goes to the nesting status of interrupt processing. Moreover, if the CPU receives another interrupt request while performing the said 1. to 5. processing steps of the current interrupt, the latest interrupt request is sampled immediately after execution of the first instruction of the current interrupt processing routine. Specifying DI as the start instruction disables maskable interrupt nesting. A reset initializes the interrupt mask register to "111", disabling all maskable interrupts. Table 3-1 shows the TMP91FU62 interrupt vectors and micro DMA start vectors. The address FFFF00H to FFFFFFH (256 bytes) is assigned for the interrupt vector area.
Page 30
2007-10-10
TMP91FU62
Table 3-1 TMP91FU62 Interrupt Vectors Table(1/2)
Default Priority 1 2 3 4 5 6 7 8 9 10 - 11 12 13 14 15 16 17 18 19 20 21 22 23 Maskable 24 25 26 27 28 29 30 31 32 33 34 35 36 37 (Reserved) (Reserved) INTTA4: 8-bit timer 4 INTTA5: 8-bit timer 5 INTTB00: 16-bit timer 0 (TB0RG0) INTTB01: 16-bit timer 0 (TB0RG1) INTTB10: 16-bit timer 1 (TB1RG0) INTTB11: 16-bit timer 1 (TB1RG1) INTTB20: 16-bit timer 2 (TB2RG0) INTTB21: 16-bit timer 2 (TB2RG1) INTTB30: 16-bit timer 3 (TB3RG0) INTTB31: 16-bit timer 3 (TB3RG1) (Reserved) (Reserved) 005CH 0060H 0064H 0068H 006CH 0070H 0074H 0078H 007CH 0080H 0084H 0088H 008CH 0090H FFFF5CH FFFF60H FFFF64H FFFF68H FFFF6CH FFFF70H FFFF74H FFFF78H FFFF7CH FFFF80H FFFF84H FFFF88H FFFF8CH FFFF90H 17H 18H 19H 1AH 1BH 1CH 1DH 1EH 1FH 20H 21H 22H 23H 24H Nonmaskable Type Interrupt Source and Source of Micro DMA Request "Reset" or "SWI 0" instruction "SWI 1" instruction INTUNDEF: Illegal instruction or "SWI 2" instruction "SWI 3" instruction "SWI 4" instruction "SWI 5" instruction "SWI 6" instruction "SWI 7" instruction (Reserved) INTWD: Watchdog timer Micro DMA (MDMA) INT0: INT0 pin INT1: INT1 pin INT2: INT2 pin INT3: INT3 pin INT4: INT4 pin INT5: INT5 pin INT6: INT6 pin INT7: INT7 pin INT8: INT8 pin (Reserved) (Reserved) INTTA0: 8-bit timer 0 INTTA1: 8-bit timer 1 Vector Value (V) 0000H 0004H 0008H 000CH 0010H 0014H 0018H 001CH 0020H 0024H - 0028H 002CH 0030H 0034H 0038H 003CH 0040H 0044H 0048H 004CH 0050H 0054H 0058H Vector Reference Address FFFF00H FFFF04H FFFF08H FFFF0CH FFFF10H FFFF14H FFFF18H FFFF1CH FFFF20H FFFF24H - FFFF28H FFFF2CH FFFF30H FFFF34H FFFF38H FFFF3CH FFFF40H FFFF44H FFFF48H FFFF4CH FFFF50H FFFF54H FFFF58H Micro DMA Start Vector - - - - - - - - - - - 0AH 0BH 0CH 0DH 0EH 0FH 10H 11H 12H 13H 14H 15H 16H
Page 31
2007-10-10
TMP91FU62
Table 3-1 TMP91FU62 Interrupt Vectors Table(2/2)
Default Priority 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 Maskable Type Interrupt Source and Source of Micro DMA Request INTTBOF0: 16-bit timer 0 (Over flow) INTTBOF1: 16-bit timer 1 (Over flow) INTTBOF2: 16-bit timer 2 (Over flow) INTTBOF3: 16-bit timer 3 (Over flow) (Reserved) INTRX0:Serial reception (Channel 0) INTTX0:Serial transmission (Channel 0) INTRX1:Serial reception (Channel 1) INTTX1:Serial transmission (Channel 1) INTRX2:Serial reception (Channel 2) INTTX2:Serial transmission (Channel 2) INTSBI0:Serial bus interface interrupt (Channel 0) (Reserved) INTRTC: Interrupt for special timer for CLOCK INTAD: AD conversion end INTTC0 Micro DMA end (Channel 0) INTTC1: Micro DMA end (Channel 1) INTTC2: Micro DMA end (Channel 2) INTTC3: Micro DMA end (Channel 3) (Reserved) : (Reserved) Vector Value (V) 0094H 0098H 009CH 00A0H 00A4H 00A8H 00ACH 00B0H 00B4H 00B8H 00BCH 00C0H 00C4H 00C8H 00CCH 00D0H 00D4H 00D8H 00DCH 00E0H : 00FCH Vector Reference Address FFFF94H FFFF98H FFFF9CH FFFFA0H FFFFA4H FFFFA8H FFFFACH FFFFB0H FFFFB4H FFFFB8H FFFFBCH FFFFC0H FFFFC4H FFFFC8H FFFFCCH FFFFD0H FFFFD4H FFFFD8H FFFFDCH FFFFE0H : FFFFFCH Micro DMA Start Vector 25H 26H 27H 28H 29H 2AH 2BH 2CH 2DH 2EH 2FH 30H 31H 32H 33H - - - - - : -
Note: Micro DMA default priority: Micro DMA stands up prior to other maskable interrupt.
Page 32
2007-10-10
TMP91FU62
3.2 Micro DMA Processing
In addition to general-purpose interrupt processing, the TMP91FU62 supports a micro DMA function. Interrupt requests set by micro DMA perform micro DMA processing at the highest priority level (Level 6) among maskable interrupts, regardless of the priority level of the particular interrupt source. The micro DMA has 4 channels and is possible continuous transmission by specifying the described later burst mode. The micro DMA has 4 channels and is possible continuous transmission by specifying the described later burst mode. Because the micro DMA function has been implemented with the cooperative operation of CPU, when CPU goes to a standby mode (STOP, IDLE1 and IDLE2) by HALT instruction, the requirement of micro DMA will be ignored (Pending) and DMA transfer is started after release HALT.
3.2.1
Micro DMA Operation
When an interrupt request specified by the micro DMA start vector register is generated, the micro DMA triggers a micro DMA request to the CPU at interrupt priority level 6 and starts processing the request in spite of any interrupt source's level. The micro DMA is ignored on = "7". The 4 micro DMA channels allow micro DMA processing to be set for up to 4 types of interrupts at any one time. When micro DMA is accepted, the interrupt request flip-flop assigned to that channel is cleared. The data are automatically transferred once (1/2/4 bytes) from the transfer source address to the transfer destination address set in the control register, and the transfer counter is decreased by 1 (-1). If the decreased result is "0", the micro DMA transfer end interrupt (INTTC0 to INTTC3) passes from the CPU to the interrupt controller. In addition, the micro DMA start vector register DMAnV is cleared to 0, the next micro DMA is disabled and micro DMA processing completes. If the decreased result is other than "0", the micro DMA processing completes if it does not specify the described later burst mode. In this case, the micro DMA transfer end interrupt (INTTC0 to INTTC3) aren't generated. If an interrupt request is triggered for the interrupt source in use during the interval between the clearing of the micro DMA start vector and the next setting, general-purpose interrupt processing executes at the interrupt level set. Therefore, if only using the interrupt for starting the micro DMA (Not using the interrupts as a general-purpose interrupt: Level 1 to 6), first set the interrupts level to 0 (Interrupt requests disabled). If using micro DMA and general-purpose interrupts together, first set the level of the interrupt used to start micro DMA processing lower than all the other interrupt levels. (Note) In this case, the cause of general interrupt is limited to the edge interrupt. The priority of the micro DMA transfer end interrupt (INTTC0 to INTTC3) is defined by the interrupt level and the default priority as the same as the other maskable interrupt. If a micro DMA request is set for more than one channel at the same time, the priority is not based on the interrupt priority level but on the channel number. The smaller channel number has the higher priority (Channel 0 (High) > Channel 3 (Low)). While the register for setting the transfer source/transfer destination addresses is a 32-bit control register, this register can only effectively output 24-bit addresses. Accordingly, micro DMA can access 16 Mbytes (The upper eight bits of the 32 bits are not valid).
Note:If the priority level of micro DMA is set higher than that of other interrupts, CPU operates as follows. In case INTxxx interrupt is generated first and then INTyyy interrupt is generated between checking "Interrupt specified by micro DMA start vector" (in the Figure 3-1) and reading interrupt vector with setting below, the vector shifts to that of INTyyy at the time. This is because the priority level of INTyyy is higher than that of INTxxx. In the interrupt routine, CPU reads the vector of INTyyy because checking of micro DMA has been finished. And INTyyy is generated regardless of transfer counter of micro DMA. INTxxx: level 1 without micro DMA INTyyy: level 6 with micro DMA
Page 33
2007-10-10
TMP91FU62
Three micro DMA transfer modes are supported: 1-byte transfer, 2-byte (One-word) transfer, and 4-byte transfer. After a transfer in any mode, the transfer source/destination addresses are increased, decreased, or remain unchanged. This simplifies the transfer of data from I/O to memory, from memory to I/O, and from I/O to I/O. For details of the transfer modes, see" 3.2.4 Detailed Description of the Transfer Mode Register ". As the transfer counter is a 16-bit counter, micro DMA processing can be set for up to 65536 times per interrupt source. (The micro DMA processing count is maximized when the transfer counter initial value is set to 0000H.) Micro DMA processing can be started by the 42 interrupts shown in the micro DMA start vectors of Table 31 and by the micro DMA soft start, making a total of 43 interrupts. Figure 3-2 shows the word transfer micro DMA cycle in transfer destination address INC mode (except for counter mode, the same as for other modes). (The conditions for this cycle are based on an external 16-bit bus, 0 waits, transfer source/transfer destination addresses both even-numberd values).
1 state DM1 DM2 DM3 DM4 (Note 1) DM5 DM6 (Note 2) DM7 DM8
X1
Transfer destination address
A0 to A23
Transfer source address
RD
WR, HWR
D0 to D15
Input
Output
Figure 3-2 Timing for Micro DMA Cycle
States 1 to 3: Instruction fetch cycle (Gets next address code). If 3 bytes and more instruction codes are inserted in the instruction queue buffer, this cycle becomes a dummy cycle. States 4 to 5: Micro DMA read cycle State 6: Dummy cycle (The address bus remains unchanged from state 5.)
States 7 to 8: Micro DMA write cycle
Note 1: If the source address area is an 8-bit bus, it is increased by two states. If the source address area is a 16-bit bus and the address starts from an odd number, it is increased by two states. Note 2: If the destination address area is an 8-bit bus, it is increased by two states. If the destination address area is a 16-bit bus and the address starts from an odd number, it is increased by two states.
Page 34
2007-10-10
TMP91FU62
3.2.2
Soft Start Function
In addition to starting the micro DMA function by interrupts, TMP91FU62 includes a micro DMA software start function that starts micro DMA on the generation of the write cycle to the DMAR register. Writing "1" to each bit of DMAR register causes micro DMA once (If write "0" to each bit, micro DMA doesn't operate) At the end of transfer, the corresponding bit of the DMAR register is automatically cleared to "0". Only one-channel can be set once for micro DMA. (Do not write "1" to plural bits.) When writing again "1" to the DMAR register, check whether the bit is "0" before writing "1". If read "1", micro DMA transfer isn't started yet. When a burst is specified by DMAB register, data is continuously transferred until the value in the micro DMA transfer counter is "0" after start up of the micro DMA. If execute soft start during micro DMA transfer by interrupt source, micro DMA transfer counter doesn't change. Don't use Read-modify-write instruction to avoid writing to other bits by mistake.
Symbol
Name
Address 89H
7 - - -
6 - - -
5 - - -
4 - - -
3 DMAR3
2 DMAR2 R/W
1 DMAR1
0 DMAR0
DMAR
DMA Request Register
RMW instructions are prohibited.
0
0
0
0
DMA request
3.2.3
Transfer Control Registers
The transfer source address and the transfer destination address are set in the following registers in CPU. Data setting for these registers is done by an "LDC cr, r" instruction.
Channel 0
DMAS0 DMAD0 DMAC0 DMAM0
DMA source address register 0: Only use LSB 24 bits DMA destination address register 0: Only use LSB 24 bits DMA counter register 0: 1 to 65536 DMA mode register 0
Channel 3
DMAS3 DMAD3 DMAC3 DMAM3
DMA source address register 3 DMA destination address register 3 DMA counter register 3 DMA mode register 3
8 bits 16 bits 32 bits
Page 35
2007-10-10
TMP91FU62 3.2.4 Detailed Description of the Transfer Mode Register
(DMAM0 to DMAM3) 0 0 0
Mode
Note: The upper three bit of data programmed to these registers must always be 0. Execution time
ZZ: 0 = Byte transfer, 1 = Word transfer, 2 = 4-byte transfer, 3 = Reserved Transfer destination address INC modeI/O to memory (DMADn+) (DMASn) DMACn DMACn - 1 if DMACn = 0 then INTTC is generated Transfer destination address DEC mode I/O to memory (DMADn-) (DMASn) DMACn DMACn - 1 if DMACn = 0 then INTTC is generated Transfer source address INT modememory to I/O (DMADn) (DMASn+) DMACn DMACn - 1 if DMACn = 0 then INTTC is generated Transfer source address DEC mode memory to I/O (DMADn) (DMASn-) DMACn DMACn - 1 if DMACn = 0 then INTTC is generated Address fixed modeI/O to I/O (DMADn) (DMASn) DMACn DMACn - 1 if DMACn = 0 then INTTC is generated Counter mode for counting number of times interrupt is generated DMASn DMASn + 1 DMACn DMACn - 1 if DMACn = 0 then INTTC is generated 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 8 states (800 ns) @ byte/word transfer 12 states (1200 ns) @ 4-byte/word transfer 5 states (500 ns)
0
0
0
Z
Z
0
0
1
Z
Z
0
1
0
Z
Z
0
1
1
Z
Z
1
0
0
Z
Z
1
0
1
0
0
Note 1: "n" is the corresponding micro DMA channels 0 to 3. DMADn+/DMASn+: Post-increment (Increment register value after transfer) DMADn-/DMASn-: Post-decrement (Decrement register value after transfer) The I/Os in the table mean fixed address and the memory means increment (INC) or decrement (DEC) addresses. Note 2: Execution time is under the condition of: 16-bit bus width (Both transfer and destination address area)/0 waits/ fc = 20 MHz/selected high-frequency mode (fc x 1) Note 3: Do not use an undefined code for the transfer mode register except for the defined codes listed in the above table.
Page 36
2007-10-10
TMP91FU62
3.3 Interrupt Controller Operation
The block diagram in Figure 3-3 shows the interrupt circuits. The left-hand side of the diagram shows the interrupt controller circuit. The right-hand side shows the CPU interrupt request signal circuit and the halt release circuit. For interrupt controller there is an interrupt request flag (Consisting of a flip-flop), an interrupt priority setting register and a micro DMA start vector register. The interrupt request flag latches interrupt requests from the peripherals. The flag is cleared to 0 in the following cases: * When reset occurs * When the CPU reads the channel vector after accepted its interrupt * When executing an instruction that clears the interrupt (Write DMA start vector to INTCLR register) * When the CPU receives a micro DMA request (when micro DMA is set) * When the micro DMA burst transfer is terminated An interrupt priority can be set independently for each interrupt source by writing the priority to the interrupt priority setting register (e.g., INTE0AD or INTE56). 6 interrupt priorities levels (1 to 6) are provided. Setting an interrupt source's priority level to 0 (or 7) disables interrupt requests from that source. The priority of non-maskable interrupts (watchdog timer interrupts) is fixed at 7. If interrupt request with the same level are generated at the same time, the default priority is used to determine which interrupt request is accepted first. The 3rd and 7th bits of the interrupt priority setting register indicate the state of the interrupt request flag and thus whether an interrupt request for a given channel has occurred. The interrupt controller sends the interrupt request and its vector address to the CPU. The CPU compares the priority value in the status register by the interrupt request signal with the priority value set; if the latter is higher, the interrupt is accepted. Then the CPU sets a value higher than the priority value by 1 (+1) in the CPU SR. Interrupt request where the priority value equals or is higher than the set value are accepted simultaneously during the previous interrupt routine. When interrupt processing is completed (after execution of the RETI instruction), the CPU restores the priority value saved in the stack before the interrupt was generated to the CPU SR. The interrupt controller also has registers (4 channels) used to store the micro DMA start vector. Writing the start vector of the interrupt source for the micro DMA processing beforehand (see Table 3-1), enables the corresponding interrupt to be processed by micro DMA processing. The values must be set in the micro DMA parameter register (e.g., DMAS and DMAD) prior to the micro DMA processing.
Page 37
2007-10-10
Interrupt controller
CPU
Interrupt request F/F
RESET Interrupt vector read
V = 20H V = 24H
S R IFF2:0
Interrupt request signal to CPU 3 3 INTRQ2 to INTRQ0 3 Priority encoder 1 7 6 6 RESET EI 1 to 7 DI
Q
1
Interrupt mask F/F
INTWD
Decoder
Priority setting register
Dn Dn+1 Dn+2 A B C Interrupt level detect D0 D1 D2 D3 D4 D5 D6 D7
Interrupt vector read If INTRQ2 to 0 then 1. IFF2 to 0
DQ CLR
Interrupt request F/F
Y1 Y2 Y3 Y4 Y5 Y6 Dn+3 1 2 Highest A priority 3 interrupt B 4 level C select 5 6 7
48
Interrupt request signal
INT0
Interrupt request F/F
RESET
S R
Q
Interrupt vector read Micro DMA acknowledge V = 28H V = 2CH V = 30H V=3 34H V = 38H V = 3CH
Interrupt vector generator
Figure 3-3 Block Diagram of Interrupt Controller
V = 40H V = 44H V = 48H V = CCH V = D0H V = D4H V = D8H V = DCH
Page 38
Software start 4 4 input OR
INT1 INT2 INT3 INT4 INT5 INT6 INT7 INT8
During IDLE1 During STOP
Halt release RESET INT0, INTRTC
Micro DMA counter zero interrupt
INTAD INTTC0 INTTC1 INTTC2 INTTC3
Micro DMA request If IFF = 7 then 0
S
Selector
Micro DMA start vector setting register D5 D4 D3 42 DQ D2 D1 6 CLR D0
A B
Micro DMA channel priority encoder
2
2
Micro DMA channel specification
TMP91FU62
2007-10-10
INTTC0
DMA0V DMA1V DMA2V DMA3V
RESET
0 1 2 3
TMP91FU62 3.3.1 Interrupt Level Setting Registers
Interrupt Level Setting Registers
Symbol Name Address 7 6 INTAD INTE0AD INT0 & INTAD enable IADC 90H R 0 0 INT2 INTE12 INT1 & INT2 enable I2C 91H R 0 0 INT4 INTE34 INT3 & INT4 enable I4C 92H R 0 0 INT6 INTE56 INT5 & INT6 enable I6C 93H R 0 0 INT8 INTE78 INT7 & INT8 enable I8C 94H R 0 0 R/W 0 0 R 0 0 R/W 0 0 I8M2 I8M1 I8M0 I7C I7M2 R/W 0 0 R 0 0 INT7 I7M1 I7M0 R/W 0 0 I6M2 I6M1 I6M0 I5C I5M2 R/W 0 0 R 0 0 INT5 I5M1 I5M0 R/W 0 0 I4M2 I4M1 I4M0 I3C I3M2 R/W 0 0 R 0 0 INT3 I3M1 I3M0 R/W 0 0 I2M2 I2M1 I2M0 I1C I1M2 R/W 0 0 R 0 0 INT1 I1M1 I1M0 R/W 0 0 IADM2 IADM1 IADM0 I0C I0M2 5 4 3 2 INT0 I0M1 I0M0 1 0
INTTA1(TMRA1) INTETA01 INTTA0 & INTTA1 enable ITA1C 96H R 0 0 R/W 0 0 R 0 ITA1M2 ITA1M1 ITA1M0 ITA0C
INTTA0 (TMRA0) ITA0M2 ITA0M1 R/W 0 0 0 ITA0M0
IxxxC Interrupt request flag
IxxM2 0 0 0 0 1 1 1 1
IxxM1 0 0 1 1 0 0 1 1
IxxM0 0 1 0 1 0 1 0 1
Function (Write) Disables interrupt requests Sets interrupt priority level to 1 Sets interrupt priority level to 2 Sets interrupt priority level to 3 Sets interrupt priority level to 4 Sets interrupt priority level to 5 Sets interrupt priority level to 6 Disables interrupt requests
Page 39
2007-10-10
TMP91FU62
Interrupt Level Setting Registers
Symbol Name Address 7 6 5 4 3 2 1 0
INTTA5 (TMRA5) INTETA45 INTTA4 & INTTA5 enable ITA5C 98H R 0 0 R/W 0 0 R 0 ITA5M2 ITA5M1 ITA5M0 ITA4C
INTTA4 (TMRA4) ITA4M2 ITA4M1 R/W 0 0 0 ITA4M0
INTTB01(TMRB0) INTETB0 Interrupt enable TMRB0 ITB01C 99H R 0 0 R/W 0 0 R 0 ITB01M2 ITB01M1 ITB01M0 ITB00C
INTTB00(TMRB0) ITB00M2 ITB00M1 R/W 0 0 0 ITB00M0
INTTB11(TMRB1) INTETB1 Interrupt enable TMRB1 ITB11C 9AH R 0 0 R/W 0 0 R 0 ITB11M2 ITB11M1 ITB11M0 ITB10C
INTTB10(TMRB1) ITB10M2 ITB10M1 R/W 0 0 0 ITB10M0
INTTB21(TMRB2) INTETB2 Interrupt enable TMRB2 ITB21C 9BH R 0 0 R/W 0 0 R 0 ITB21M2 ITB21M1 ITB21M0 ITB20C
INTTB20(TMRB2) ITB20M2 ITB20M1 R/W 0 0 0 ITB20M0
INTTB31(TMRB3) INTETB3 Interrupt enable TMRB3 ITB31C 9CH R 0 Interrupt enable TMRB0/1 (Over flow) 0 R/W 0 0 R 0 ITB31M2 ITB31M1 ITB31M0 ITB30C
INTTB30(TMRB3) ITB30M2 ITB30M1 R/W 0 0 0 ITB30M0
INTTBOF1(TMRB1 Over flow) ITF1C 9EH R 0 0 R/W 0 0 R 0 ITF1M2 ITF1M1 ITF1M0 ITF0C INTETB01V
INTTBOF0(TMRB0 Over flow) ITF0M2 ITF0M1 R/W 0 0 0 ITF0M0
IxxxC Interrupt request flag
IxxM2 0 0 0 0 1 1 1 1
IxxM1 0 0 1 1 0 0 1 1
IxxM0 0 1 0 1 0 1 0 1
Function (Write) Disables interrupt requests Sets interrupt priority level to 1 Sets interrupt priority level to 2 Sets interrupt priority level to 3 Sets interrupt priority level to 4 Sets interrupt priority level to 5 Sets interrupt priority level to 6 Disables interrupt requests
Page 40
2007-10-10
TMP91FU62
Interrupt Level Setting Registers
Symbol Name Interrupt enable TMRB2/3 (Over flow) Address 7 6 5 4 3 2 1 0
INTTBOF3(TMRB3 Over flow) ITF3C 9FH R 0 0 INTRTC INTERTC Interrupt enable INTRTC IRTCC A0H R 0 0 INTTX0 INTES0 INTRX0 & INTTX0 enable ITX0C A1H R 0 0 INTTX1 INTES1 INTRX1 & INTTX1 enable ITX1C A2H R 0 0 INTTX2 INTES2 INTRX2 & INTTX2 enable ITX2C A3H R 0 0 - INTESBI0 INTSBI0 enable - A4H - - - INTTC1 INTETC01 INTTC0 & INTTC1 enable ITC1C A5H R 0 0 INTTC3 INTETC23 INTTC2 & INTTC3 enable ITC3C A6H R 0 0 R/W 0 0 R 0 ITC3M2 ITC3M1 ITC3M0 ITC2C R/W 0 0 R 0 ITC1M2 ITC1M1 ITC1M0 ITC0C - - - R 0 - - - ISBI0C R/W 0 0 R 0 ITX2M2 ITX2M1 ITX2M0 IRX2C R/W 0 0 R 0 ITX1M2 ITX1M1 ITX1M0 IRX1C R/W 0 0 R 0 ITX0M2 ITX0M1 ITX0M0 IRX0C R/W 0 0 - - IRTCM2 IRTCM1 IRTCM0 - R/W 0 0 R 0 ITF3M2 ITF3M1 ITF3M0 ITF2C INTETB23V
INTTBOF2(TMRB2 Over flow) ITF2M2 ITF2M1 R/W 0 - - - - - INTRX0 IRX0M2 IRX0M1 R/W 0 INTRX1 IRX1M2 IRX1M1 R/W 0 INTRX2 IRX2M2 IRX2M1 R/W 0 INTSBI0 ISBI0M2 ISBI0M1 R/W 0 INTTC0 ITC0M2 ITC0M1 R/W 0 INTTC2 ITC2M2 ITC2M1 R/W 0 0 0 ITC2M0 0 0 ITC0M0 0 0 ISBI0M0 0 0 IRX2M0 0 0 IRX1M0 0 0 IRX0M0 - - - 0 0 ITF2M0
IxxxC Interrupt request flag
IxxM2 0 0 0 0 1 1 1 1
IxxM1 0 0 1 1 0 0 1 1
IxxM0 0 1 0 1 0 1 0 1
Function (Write) Disables interrupt requests Sets interrupt priority level to 1 Sets interrupt priority level to 2 Sets interrupt priority level to 3 Sets interrupt priority level to 4 Sets interrupt priority level to 5 Sets interrupt priority level to 6 Disables interrupt requests
Page 41
2007-10-10
TMP91FU62 3.3.2 External Interrupt Control
External Interrupt Control Register (IIMC)
Symbol Name Address 7 - 8CH 0 RMW instructions are prohibited. 0 0 0 6 - 5 - 4 - W 0 0 INT0 EDGE 0: Rising 1: Falling 0 INT0 mode 0: Edge 1: Level 0 3 - 2 I0EDGE 1 I0LE 0 -
IIMC
Interrupt input mode control
Always write "0".
-
-
-
-
-
INT0 setting
P7FC 1 1 1 1 0 0 1 1 0 1 0 1 INT0 Rising edge interruption Falling edge interruption "H" level INT "L" level INT
3.3.3
Interrupt Request Flag Clear Register
The interrupt request flag is cleared by writing the appropriate micro DMA start vector, as given in Table 31, to the register INTCLR. For example, to clear the interrupt flag INT0, perform the following register operation after execution of the DI instruction. INTCLR 0AH: Clears interrupt request flag INT0.
Interrupt Request Flag Clear Register (INTCLR)
Symbol Name Address 88H Interrupt Clear Control RMW instructions are prohibited. 7 - - - 6 - - - 0 0 0 5 CLRV5 4 CLRV4 3 CLRV3 W 0 0 0 2 CLRV2 1 CLRV1 0 CLRV0
INTCLR
Interrupt vector
Page 42
2007-10-10
TMP91FU62
3.3.4
Micro DMA Start Vector Registers
This register assigns micro DMA processing to which interrupt source. The interrupt source with a micro DMA start vector that matches the vector set in this register is assigned as the micro DMA start source. When the micro DMA transfer counter value reaches 0, the micro DMA transfer end interrupt corresponding to the channel is sent to the interrupt controller, the micro DMA start vector register is cleared, and the micro DMA start source for the channel is cleared. Therefore, to continue micro DMA processing, set the micro DMA start vector register again during the processing of the micro DMA transfer end interrupt. If the same vector is set in the micro DMA start vector registers of more than one channel, the channel with the lowest number has a higher priority. Accordingly, if the same vector is set in the micro DMA start vector registers of two channels, the interrupt generated in the channel with the lower number is executed until micro DMA transfer is complete. If the micro DMA start vector for this channel is not set again, the next micro DMA is started for the channel with the higher number. (Micro DMA chaining)
Micro DMA Start Vector Registers (DMAnV)
Symbol Name Address 7 - DMA0 Start Vector - 80H - - 0 0 0 0 0 0 6 - - 5 DMA0V5 4 DMA0V4 3 DMA0V3 R/W 2 DMA0V2 1 DMA0V1 0 DMA0V0
DMA0V
DMA0 start vector - DMA1 Start Vector - 81H - - 0 0 0 0 0 0 - - DMA1V5 DMA1V4 DMA1V3 R/W DMA1V2 DMA1V1 DMA1V0
DMA1V
DMA1 start vector - DMA2 Start Vector - 82H - - 0 0 0 0 0 0 - - DMA2V5 DMA2V4 DMA2V3 R/W DMA2V2 DMA2V1 DMA2V0
DMA2V
DMA2 start vector - DMA3 Start Vector - 83H - - 0 0 0 0 0 0 - - DMA3V5 DMA3V4 DMA3V3 R/W DMA3V2 DMA3V1 DMA3V0
DMA3V
DMA3 start vector
Page 43
2007-10-10
TMP91FU62
3.3.5
Micro DMA Burst Specification
Specifying the micro DMA burst continues the micro DMA transfer until the transfer counter register reaches 0 after micro DMA start. Setting a bit which corresponds to the micro DMA channel of the DMAB registers mentioned below to "1" specifies a burst. If other interrupts (maskable/nonmaskable is not concerned) are generated during burst transfer, interrupt is executed after completed burst transfer.
Micro DMA Burst Request Registers (DMAR)
Symbol Name Address 89H DMA Software Request Register RMW instructions are prohibited. 7 - - - 6 - - - 5 - - - 4 - - - 0 0 3 DMAR3 2 DMAR2 R/W 0 0 1 DMAR1 0 DMAR0
DMAR
1: DMA software request - - - - - - - - - - 0 0 DMAB3 DMAB2 R/W 0 0 DMAB1 DMAB0
DMAB
DMA Burst Register
- 8AH -
1: DMA burst request
Page 44
2007-10-10
TMP91FU62
3.3.6
Attention Point
The instruction execution unit and the bus interface unit of this CPU operate independently. Therefore, immediately before an interrupt is generated, if the CPU fetches an instruction that clears the corresponding interrupt request flag, the CPU may execute the instruction that clears the interrupt request flag (Note) between accepting and reading the interrupt vector. In this case, the CPU reads the default vector 0008H and reads the interrupt vector address FFFF08H. To avoid the above problem, place instructions that clear interrupt request flags after a DI instruction. And in the case of setting an interrupt enable again by EI instruction after the execution of clearing instruction, execute EI instruction after clearing and more than 1-instructions (ex. "NOP" * 1 times). If executed EI instruction without waiting NOP instruction after execution of clearing instruction, interrupt will be enable before request flag is cleared. In the case of changing the value of the interrupt mask register by execution of POP SR instruction, disable an interrupt by DI instruction before execution of POP SR instruction. In addition, take care as the following 2 circuits are exceptional and demand special attention.
In level mode INT0 is not an edge-triggered interrupt. Hence, in level mode the interrupt request flip-flop for INT0 does not function. The peripheral interrupt request passes through the S input of the flip-flop and becomes the Q output. If the interrupt input mode is changed from edge mode to level mode, the interrupt request flag is cleared automatically. If the CPU enters the interrupt response sequence as a result of INT0 going from 0 to 1, INT0 must then be held at 1 until the interrupt response sequence has been completed. If INT0 is set to level mode so as to release a halt state, INT0 must be held at 1 from the time INT0 changes from 0 to 1 until the halt state is released. (Hence, it is necessary to ensure that input noise is not interpreted as a 0, causing INT0 to revert to 0 before the halt state has been released.) When the mode changes from level mode to edge mode, interrupt request flags which were set in level mode will not be cleared. Interrupt request flags must be cleared using the following sequence. DI LD (IIMC), 00H ; Switches interrupt input mode from level mode to edge mode. LD (INTCLR), 0AH ; Clears interrupt request flag. NOP ; Wait EI instruction EI The interrupt request flip-flop can only be cleared by reset or by reading the serial channel receive buffer. It cannot be cleared by writing INTCLR register.
INT0 level mode
INTRXn
Note: The following instructions or pin input state changes are equivalent to instructions that clear the interrupt request flag. INT0: Instructions which switch to level mode after an interrupt request has been generated in edge mode. The pin input change from high to low after interrupt request has been generated in level mode. (H L) INTRXn: Instruction which reads the receive buffer.
Page 45
2007-10-10
TMP91FU62
4. Port Function
The TMP91FU62 features 69 bit settings which relate to the various I/O ports. As well as general-purpose I/O port functionality, the port pins also have I/O functions which relate to the built-in CPU and internal I/Os. Table 4-1 lists the functions of each port pin. Table 4-1 lists the functions of each port pin. Table 4-2 lists I/O registers and their specifications. Table 4-1 Port Functions (R: PU = with programmable pull-up resistor) (1/2)
Port Names Port0 Port1 Pin Names P00 to P07 P10 to P17 P30 P31 Port3 P32 P33 P40 P41 Port4 P42 P43 P50 P51 P52 P53 Port5 P54 P55 P56 P57 P60 P61 P62 P63 Port6 P64 P65 P66 P67 P70 P71 P72 Port7 P73 P74 P75 1 1 1 I/O I/O I/O 1 1 1 1 1 1 1 I/O I/O I/O I/O I/O I/O I/O 1 1 1 1 1 1 1 1 I/O I/O I/O I/O I/O I/O I/O I/O 1 1 1 1 1 1 I/O I/O I/O I/O I/O I/O PU PU Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit TA4IN TA5OUT INT0 RXD2, TXD2 SCLK2, CTS2 AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 AN8 AN9 AN10 AN11 AN12 AN13 AN14 AN15 TA0IN TA1OUT 1 1 1 1 I/O I/O I/O I/O Number of Pins 8 8 1 1 Direction I/O I/O I/O I/O R Direction Setting Unit Bit Bit Bit Bit Bit Bit Bit Bit TB3IN0, INT3, SDA0 TB3IN1, INT4, SCL0 TB3OUT0 TB3OUT1 SCOUT TXD2, RXD2 Pin Names for Built-in Functions
- - - - - -
PU PU
- - - - - - - - - - - - - - - - - - - - - -
Page 46
2007-10-10
TMP91FU62
Table 4-1 Port Functions (R: PU = with programmable pull-up resistor) (2/2)
Port Names Pin Names P80 P81 P82 P83 Port8 P84 P85 P86 P87 P90 P91 P92 P93 Port9 P94 P95 P96 P97 PA0 PA1 PortA PA2 PA3 PB0 PortB PB1 PB2 1 1 1 1 1 I/O I/O I/O I/O I/O 1 1 1 1 1 1 I/O I/O I/O I/O I/O I/O 1 1 1 1 1 1 1 1 I/O I/O I/O I/O I/O I/O I/O I/O Number of Pins 1 1 1 1 Direction I/O I/O I/O I/O R Direction Setting Unit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Bit Pin Names for Built-in Functions TB0IN0, INT5 TB0IN1, INT6 TB0OUT0 TB0OUT1 TB1IN0, INT7 TB1IN1, INT8 TB1OUT0 TB1OUT1 TXD0, RXD0 RXD0, TXD0 SCLK0, CTS0 TXD1, RXD1 RXD1, TXD1 SCLK1, CTS1 XT1 XT2 TB2IN0, INT1 TB2IN1, INT2 TB2OUT0 TB2OUT1
- - - - - - - - - - - - - - - - - - - - - - -
Page 47
2007-10-10
TMP91FU62
Table 4-2
Ports
I/O Port Setting List(1/3)
I/O Register Setting Values Pin Names Specifications Pn Input port PnCR 0 None 1 0 None 1 0 1 1 0 1 0 1 1 0 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 None 0 1 0 0 1 0 0 1 None 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 None None None None 1 1 1 None 0 1 0 None None 0 1 None None None 0 0 0 0 0 0 0 None None 0 1 1 0 1 1 None 0 0 0 None None None None PnFC PnFC2 ODE
Port0
P00 to P07 Output port Input port
x x x x x x x x x x x
#1
Port1
P10 to P17 Output port Input port P30 to P31 Output port (CMOS output) Output port (open drain output) Input port P32 to P33 Output port TB3IN0 Input, INT3 Input
-
0 1
-
0 1
Port3
P30
SDA0 input/output (CMOS output) SDA0 input/output (open drain output) TB3IN1 Input, INT4 Input
x x x x x x
0 1
-
0 1
P31
SCL0 input/output (CMOS output) SCL0 input/output (open drain output)#2
P32 P33
TB3OUT0 output TB3OUT1 output Input port (without pull up)
P40, P43
Input port (with pull up) Output port Input port (without pull up) Input port (with pull up)
x
0 1
- -
0 1
P41 Output port (CMOS output) Output port (open drain output) Input port (without pull up) Port4 P42 Input port (with pull up) Output port P40 SCOUT output TXD2 output (CMOS output) P41 TXD2 output (open drain output)#2 P42 RXD2 Input SCLK2 Input P43 SCLK2 output CTS2 Input Input port Port5 P50 to P57 Output port AN0 to AN7 Input #2 Input port Port6 P60 to P67 Output port AN8 to AN15 Input
#3
x x
0 1
x x x x x x x x x x x x x x Page 48
2007-10-10
TMP91FU62
Table 4-2
Ports
I/O Port Setting List(2/3)
I/O Register Setting Values Pin Names Specifications Pn Input port P70 to P75 Output port P70 TA0IN Input TA1OUT output TA4IN Input TA5OUT output INT0 Input Input port P80 to P87 Output port P80 P81 P82 TB0IN0, INT5 Input TB0IN1, INT6 Input TB0OUT0 output TB0OUT1 output TB1IN0, INT7 Input TB1IN1, INT8 Input TB1OUT0 output TB1OUT1 output PnCR 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 1 PnFC 0 0 None 1 None 1 1 0 0 1 1 1 None 1 1 1 1 1 None None None PnFC2 ODE
x x x x x x x x x x x x x x x x x
Port7
P71 P73 P74 P75
Port8 P83 P84 P85 P86 P87
Page 49
2007-10-10
TMP91FU62
Table 4-2
Ports
I/O Port Setting List(3/3)
I/O Register Setting Values Pin Names Specifications Pn P91 to P92, P94 to P95 Input port Output port Input port P90, P93 Output port (CMOS output) Output port (open drain output) TXD0 output (CMOS output) P90 TXD0 output (open drain output)#2 P91 RXD0 Input SCLK0 Input P92 SCLK0 output CTS0 Input TXD1 output (CMOS output) P93 TXD1 output (open drain output)#2 P94 RXD1 Input SCLK1 Input P95 SCLK1 output CTS1 Input Input port P96 to P97 Output port XT1 to XT2 Input port PA0 to PA3 Output port PA0 TB2IN0 Input, INT1 Input TB2IN1 Input, INT2 Input TB2OUT0 TB2OUT1 Input port
#3
PnCR 0 1 0 1 1 1 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0
PnFC 0
PnFC2
ODE
x x x x x x x x x x x x x x x x x x x x x x x x x x x x
None 0 0 0 0 1 1 None 0 1 None 0 1 1 None 0 1 0 1 1 0 0 0 1 None 1 1 1 None None None 0 1 None None
-
0 1 0 1 None
Port9
PortA PA1 PA2 PA3
PortB
PB0 to PB2 Output port
None 1
None
None
#1 #2 #3
If using P30/P31/P41/P90/P93 as open-drain output in SDA0/SCL0/TXD2/TXD0/TXD1 output, please set ODE. If using P50 to P57,P60 to P67 as an analog input, please set ADCCR1. If using P96 to P97 as XT1-XT2, please set SYSCR0.
Note:
x:Don't care
Page 50
2007-10-10
TMP91FU62
4.1 Port 0 (P00 to P07)
Port 0 is an 8-bit general-purpose I/O port. Each bit can be set individually for input or output using the control register P0CR. Reset operation initializes all bits of the control register P0CR to "0" and sets port 0 to input port.
Reset
Direction control (on bit basis)
Internal data bus
P0CR write Port 0 P00 to P07 Output buffer P0 write S B A P0 read
Figure 4-1 Port 0
Port 0 Register
7 Bit symbol P0 (0000H) Read/Write After reset P07 6 P06 5 P05 4 P04 R/W Data from external port (Output latch register is undefined.) 3 P03 2 P02 1 P01 0 P00
Port 0 Control Register
(Read-modify-write instructions are prohibited.) 7 6 P06C 5 P05C 4 P04C W 0 0 0 0 0 0 0 0 3 P03C 2 P02C 1 P01C 0 P00C
Bit symbol P0CR (0002H) Read/Write After reset Function
P07C
0: Input 1: Output
P0xC 0 1
P07 function input port output port
P06 function input port output port
P05 function input port output port
P04 function input port output port
P03 function input port output port
P02 function input port output port
P01 function input port output port
P00 function input port output port
Note: is bit X of each register P0CR.
Page 51
2007-10-10
TMP91FU62
4.2 Port 1 (P10 to P17)
Port 1 is an 8-bit general-purpose I/O port. Each bit can be set individually for input or output using the control register P1CR. Reset operation initializes all bits of output latch P1, the control register P1CR to "0" and sets port 1 to input port.
Reset
Direction control (on bit basis)
Internal data bus
P1CR write Port 1 P10 to P17 Output buffer P1 write S B A P1 read
Figure 4-2 Port 1
Page 52
2007-10-10
TMP91FU62
Port 1 Register
7 P1 (0001H) Bit symbol Read/Write After reset P17 6 P16 5 P15 4 P14 R/W Data from external port (Output latch register is cleared to "0".) 3 P13 2 P12 1 P11 0 P10
Port 1 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P1CR (0004H) Read/Write After reset Function 0 0 0 0 P17C 6 P16C 5 P15C 4 P14C W 0 0 0 0 3 P13C 2 P12C 1 P11C 0 P10C
0: Input 1: Output
P1xC 0 1
P17 function input port output port
P16 function input port output port
P15 function input port output port
P14 function input port output port
P13 function input port output port
P12 function input port output port
P11 function input port output port
P10 function input port output port
Note: is bit X of each register P1CR.
Page 53
2007-10-10
TMP91FU62
4.3 Port3 (P30 to P33)
Port 3 is an 4-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register P3 are set to "1". There are the following functions in addition to an I/O port. This function enable each function by writing "1" to applicable bit of port 3 function register P3FC. *The input function of external interrupt (INT3, INT4) *The input function of 16-bit timer 3 (TB3IN0, TB3IN1) *The output function of 16-bit timer 3 (TB3OUT0, TB3OUT1) *The I/O function of serial bus interface 0 (SDA0, SCL0) Reset operation initializes, P3CR,P3FC and P3FC2 to "0", all bits are set to input port. And Port 30 and 31 have a programmable open-drain function which can be controlled by the ODE register.
Direction control (on bit basis)
P3CR write
Function control 2 (on bit basis) Internal data bus P3FC2 write
S
A
S
Open-drain possible: ODE
P3 write
B
P30(TB3IN0,INT3,SDA0) P31(TB3IN1,INT4,SCL0)
SDA0 SCL0
Function control (on bit basis) P3FC write
SB
P3 TB3IN0,INT3 TB3IN1,INT4 SDA0 SCL0
A
Figure 4-3 Port 30 and 31
Page 54
2007-10-10
TMP91FU62
Direction control (on bit basis)
P3CR
Function control (on bit basis)
Internal data bus
P3FC S
A
S P32(TB3OUT0)
P3 TB3OUT0
B
SB
P3
A
Direction control (on bit basis)
P3CR
(
) P3FC write S
Internal data bus
A
S P33(TB3OUT1)
P3 TB3OUT1
B
SB
P3
A
Figure 4-4 Port 32 and 33
Page 55
2007-10-10
TMP91FU62
Port 3 Register
7 P3 (000CH) Bit symbol Read/Write After reset Function 6 5 4 3 P33 2 P32 R/W Data from external port (Output latch register is set to "1".) output mode 1 P31 0 P30
- - -
- - -
-
- - -
- - -
Port 3 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P3CR (000EH) Read/Write After reset Function 6 5 4 3 P33C 2 P32C W 0 0 0 0 1 P31C 0 P30C
- - -
- - -
-
- - -
- - -
0:Input 1:Output
Port 3 Function Register (Read-modify-write instructions are prohibited.)
7 P3FC (000FH) Bit symbol Read/Write After reset 6 5 4 3 P33F 2 P32F W 0 0 0 0 1 P31F 0 P30F
- - -
- - -
- - -
- - -
Port 3 Function Register 2 (Read-modify-write instructions are prohibited.)
7 P3FC2 (000DH) Bit symbol Read/Write After reset 6 5 4 3 2 1 P31F2 W 0 0 0 P30F2
- - -
- - -
- - -
- - -
- - -
- - -
P3xF2 0 0 0 0 1 1 1 1
P3xF 0 0 1 1 0 0 1 1
P3xC 0 1 0 1 0 1 0 1
P33 function input port output port reserved TB3OUT1 reserved reserved reserved reserved
P32 function input port output port reserved TB3OUT0 reserved reserved reserved reserved
P31 function input port output port TB3IN1/INT4 reserved reserved SCL0 reserved reserved
P30 function input port output port TB3IN0/INT3 reserved reserved SDA0 reserved reserved
Note 1: // is bit X of each register P3FC2/P3FC/P3CR.
Page 56
2007-10-10
TMP91FU62
4.4 Port 4 (P40 to P43)
Port 4 is an 4-bit general-purpose I/O port. Reset operation initializes to input port, and connects a pull-up resistor. All bits of output latch register P4 are set to "1". There are the following functions in addition to an I/O port. This function enable each function by writing "1" to applicable bit of port 4 function register P4FC. *The I/O function of the serial channel 2 (RXD2, TXD2, SCLK2/CTS2) *The output function of a system clock signal (SCOUT) Reset operation initializes, P4CR,P4FC and P4FC2 to "0", all bits are set to input port. And Port 41 have a programmable open-drain function which can be controlled by the ODE register.
Reset
Direction control (on bit basis) P4CR write
Function control 2 (on bit basis) Internal data bus P-ch P4FC2 write
(Programmable pull up)
Selector
Output buffer
P4 write
P4 read
Selector
Figure 4-5 Port 40
Page 57
2007-10-10
TMP91FU62
Reset
Direction control (on bit basis) P4CR write
Function control 2 (on bit basis) P4FC2 write Internal data bus Open-drain possible: ODE P-ch
(Programmable pull up)
SIO exchange 1 SIOCHG1 write
P4 write
P4 read
Selector
Figure 4-6 Port 41
Selector
Page 58
2007-10-10
TMP91FU62
Reset
Direction control (on bit basis) P4CR write Open-drain possible: SIOCHG1 P-ch
(Programmable pull up)
Internal data bus
SIO exchang 1 SIOCHG1 write
Selector
Output buffer
P4 write
P4 read
Selector
Figure 4-7 Port 42
Page 59
2007-10-10
TMP91FU62
Reset
Direction control (on bit basis) P4CR write Function control 2 (on bit basis) P-ch P4FC2 write
(Programmable pull up)
Internal data bus
Selector
Output buffer
P4 write
P4 read
Selector
Figure 4-8 Port 43
Page 60
2007-10-10
TMP91FU62
Port 4 Register
7 P4 (0010H) Bit symbol Read/Write After reset 6 5 4 3 P43 2 P42 R/W Data from external port (Output latch register is set to "1".) 0 (Output latch register): Pull-up resistor OFF 1 (Output latch register): Pull-up resistor ON 1 P41 0 P40
- - -
- - -
- - -
- - -
Function
Port 4 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P4CR (0012H) Read/Write After reset Function 6 5 4 3 P43C 2 P42C W 0 0 0 0 1 P41C 0 P40C
- - -
- - -
- - -
- - -
0: Input 1: Output
Port 4 Function Register 2 (Read-modify-write instructions are prohibited.)
7 P4FC2 (0011H) Bit symbol Read/Write After reset 6 5 4 3 P43F2 W 0 2 1 P41F2 W 0 0 0 P40F2
- - -
- - -
- - -
- - -
- - -
P4xF2
P4xC
P43 function input port (SCLK2/CTS2) output port reserved SCLK2
P42 function input port (RXD2) output port reserved reserved
P41 function input port output port reserved TXD2
P40 function input port output port reserved SCOUT
0 0 1 1
0 1 0 1
Note 1: / is bit X of each register P4FC2/P4CR. Note 2: When port 4 is used as input mode, P4 register controls internal pull-up resistor. Read-modify-write instruction is prohibited in input mode or I/O mode. Setting the internal pull-up resistor may be depended on the states of the input pin. Note 3: When setting TXD2 pin to open-drain output, write "1" to bit2 of ODE register. P42/RXD2 pin does not have a register which changes Port/Function. For example, when it is also used as an input port, the input signal is inputted to SIO as serial receiving data.
Page 61
2007-10-10
TMP91FU62
4.5 Port 5 (P50 to P57)
Port 5 is an 8-bit general-purpose I/O port. By the reset action, it becomes Hi-Z and becomes analog input permission.All bits of output latch register P5 are set to "1". There are the following functions in addition to an I/O port. *The input function of the Analog/Digital Converter (AN0 to AN7) Reset operation initializes, P5CR,P5FC to "0", all bits are set to input port.
Reset Direction control (on bit basis) P5CR write Function control (on bit basis) P5FC write
Internal data bus
S
P5 write P5 read
S
Port 5 P50 to P57 (AN0 to AN7)
B
A
AD
AD read
Figure 4-9 Port 5
Page 62
2007-10-10
TMP91FU62
Port 5 Register
7 P5 (0014H) Bit symbol Read/Write After reset P57 6 P56 5 P55 4 P54 R/W Data from external port (Output latch register is set to "1".) 3 P53 2 P52 1 P51 0 P50
Port 5 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P5CR (0016H) Read/Write After reset Function 0 0 0 0 P57C 6 P56C 5 P55C 4 P54C W 0 0 0 0 3 P53C 2 P52C 1 P51C 0 P50C
0: Input 1: Output
Port 5 Function Register (Read-modify-write instructions are prohibited.)
7 Bit symbol Read/Write P5FC (0017H) After reset 0 P57 input 0:disable 1:enable 0 P56 input 0:disable 1:enable 0 P55 input 0:disable 1:enable 0 P54 input 0:disable 1:enable P57F 6 P56F 5 P55F 4 P54F W 0 P53 input 0:disable 1:enable 0 P52 input 0:disable 1:enable 0 P51 input 0:disable 1:enable 0 P50 input 0:disable 1:enable 3 P53F 2 P52F 1 P51F 0 P50F
Function
P5xF 0 0 1 1
P5xC 0 1 0 1
P57 function input disable output port input enable output port
P56 function input disable output port input enable output port
P55 function input disable output port input enable output port
P54 function input disable output port input enable output port
P53 function input disable output port input enable output port
P52 function input disable output port input enable output port
P51 function input disable output port input enable output port
P50 function input disable output port input enable output port
Note 1: / is bit X of each register P5FC/P5CR. Note 2: The input channel selection of AD converter are set by AD converter mode register ADCCR1.
Page 63
2007-10-10
TMP91FU62
4.6 Port 6 (P60 to P67)
Port 6 is an 8-bit general-purpose I/O port. By the reset action, it becomes Hi-Z and becomes analog input permission.All bits of output latch register P6 are set to "1". There are the following functions in addition to an I/O port. *The input function of the Analog/Digital Converter (AN8 to AN15) Reset operation initializes, P6CR,P6FC to "0", all bits are set to input port.
Reset Direction control (on bit basis) P6CR write Function control (on bit basis) P6FC write
Internal data bus
S
S
P6 write P6 read
B
Port 6 P60 to P67 (AN8 to AN15)
A
AD
AD read
Figure 4-10 Port 6
Page 64
2007-10-10
TMP91FU62
Port 6 Register
7 P6 (0018H) Bit symbol Read/Write After reset P67 6 P66 5 P65 4 P64 R/W Data from external port (Output latch register is set to "1".) 3 P63 2 P62 1 P61 0 P60
Port 6 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P6CR (001AH) Read/Write After reset Function 0 0 0 0 P67C 6 P66C 5 P65C 4 P64C W 0 0 0 0 3 P63C 2 P62C 1 P61C 0 P60C
0: Input 1: Output
Port 6 Function Register (Read-modify-write instructions are prohibited.)
7 Bit symbol Read/Write P6FC (001BH) After reset 0 P67 input 0:disable 1:enable 0 P66 input 0:disable 1:enable 0 P65 input 0:disable 1:enable 0 P64 input 0:disable 1:enable P67F 6 P66F 5 P65F 4 P64F W 0 P63 input 0:disable 1:enable 0 P62 input 0:disable 1:enable 0 P61 input 0:disable 1:enable 0 P60 input 0:disable 1:enable 3 P63F 2 P62F 1 P61F 0 P60F
Function
P6xF 0 0 1 1
P6xC 0 1 0 1
P67 function input disable output port input enable output port
P66 function input disable output port input enable output port
P65 function input disable output port input enable output port
P64 function input disable output port input enable output port
P63 function input disable output port input enable output port
P62 function input disable output port input enable output port
P61 function input disable output port input enable output port
P60 function input disable output port input enable output port
Note 1: / is bit X of each register P6FC/P6CR. Note 2: The input channel selection of AD converter are set by AD converter mode register ADCCR1.
Page 65
2007-10-10
TMP91FU62
4.7 Port 7 (P70 to P75)
Port 7 is an 6-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register P7 are set to "1". There are the following functions in addition to an I/O port. This function enable each function by writing "1" to applicable bit of port 7 function register P7FC. *The I/O function of 8-bit timer 01 (TA0IN,TA1OUT) *The I/O function of 8-bit timer 45 (TA4IN,TA5OUT) *The input function of external interrupt (INT0) Reset operation initializes, P7CR and P7FC to "0", all bits are set to input port.
Direction control (on bit basis) P7CR S P70 (TA0IN) P73 (TA4IN)
P7
SB A
TA0IN TA4IN
P7
Internal data bus
Direction control (on bit basis) P7CR Function control (on bit basis) P7FC S AS B P7 F/F OUT
TA1OUT: TMRA1 TA3OUT: TMRA3 TA5OUT: TMRA5
P71 (TA1OUT) P74 (TA5OUT)
B S P7
Figure 4-11 Port 70, 71, 73 and 74
Page 66
2007-10-10
TMP91FU62
Reset
Direction control (on bit basis)
Internal data bus
P7CR write P72 Output buffer P7 write S B A P7 read
Figure 4-12 Port 72
Direction control (on bit basis) Internal data bus P7CR Function control (on bit basis) P7FC
S Output latch
P7
P75(INT0)
S
B
Selector P7
A
&
IIMC
Figure 4-13 Port 75
Page 67
2007-10-10
TMP91FU62
Port 7 Register
7 P7 (001CH) Bit symbol Read/Write After reset 6 5 P75 4 P74 3 P73 R/W Data from external port (Output latch register is set to "1".) 2 P72 1 P71 0 P70
- - -
- - -
Port 7 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P7CR (001EH) Read/Write After reset Function 6 5 P75C 4 P74C 3 P73C W 0 0 0 0 0 0 2 P72C 1 P71C 0 P70C
- - -
- - -
0: Input 1: Output
Port 7 Function Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P7FC (001FH) Read/Write After reset Function 6 5 P75F W 0 0: port 1: INT0 0 0: port 1: TA5OUT 4 P74F 3 2 1 P71F W 0 0: port 1: TA1OUT 0
- - -
- - -
- - -
- - -
- - -
P75 INT0 setting
1 1 1 1 0 0 1 1 0 1 0 1 INT0 Rising edge detect INT falling edge detect INT H level INT L level INT
P7xF
P7xC
P75 function input port output port INT0 reserved
P74 function input port output port reserved TA5OUT
P73 function input port (TA4IN) output port reserved reserved
P72 function input port output port reserved reserved
P71 function input port output port reserved TA1OUT
P70 function input port (TA0IN) output port reserved reserved
0 0 1 1
0 1 0 1
Note 1: / is bit X of each register P7FC/P7CR. Note 2: P70/TA0IN, P73/TA4IN pin dose not have a register changing PORT/FUNCTION. For example, when it is used as an input port, the input signal is inputted to 8bit Timer.
Page 68
2007-10-10
TMP91FU62
4.8 Port 8 (P80 to P87)
Port 8 is an 8-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register P8 are set to "1". There are the following functions in addition to an I/O port. This function enable each function by writing "1" to applicable bit of port 8 function register P8FC. *The I/O function of 16-bit timer 0 (TB0IN0,TB0IN1,TB0OUT0,TB0OUT1) *The I/O function of 16-bit timer 1 (TB1IN0,TB1IN1,TB1OUT0,TB1OUT1) *The input function of external interrupt (INT5 to INT8) Reset operation initializes, P8CR and P8FC to "0", all bits are set to input port.
Direction control (on bit basis) P8CR Function control (on bit basis) P8FC S P80 (TB0IN0/INT5) P81 (TB0IN1/INT6) P84 (TB1IN0/INT7) P85 (TB1IN1/INT8) SB A
P8
Internal data bus
P8 TB0IN0, INT5 TB0IN1, INT6 TB1IN0, INT7 TB1IN1, INT8
Direction control (on bit basis) P8CR Function control (on bit basis) P8FC S AS B P8 F/F OUT
TB0OUT0: TMRB0 TB0OUT1: TMRB0 TB1OUT0: TMRB1 TB1OUT1: TMRB1
P82 (TB0OUT0) P83 (TB0OUT1) P86 (TB1OUT0) P87 (TB1OUT1)
B S
P8
Figure 4-14 Port 8
Page 69
2007-10-10
TMP91FU62
Port 8 Register
7 P8 (0020H) Bit symbol Read/Write After reset P87 6 P86 5 P85 4 P84 R/W Data from external port (Output latch register is set to "1".) 3 P83 2 P82 1 P81 0 P80
Port 8 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P8CR (0022H) Read/Write After reset Function 0 0 0 0 P87C 6 P86C 5 P85C 4 P84C W 0 0 0 0 3 P83C 2 P82C 1 P81C 0 P80C
0: Input 1: Output
Port 8 Function Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P8FC (0023H) Read/Write After reset 0 0: port 1: TB1OUT1 0 0: port 1: TB1OUT0 0 0: port 1: TB1IN1, INT8 0 0: port 1: TB1IN0, INT7 P87F 6 P86F 5 P85F 4 P84F W 0 0: port 1: TB0OUT1 0 0: port 1: TB0OUT0 0 0: port 1: TB0IN1, INT6 0 0: port 1: TB0IN0, INT5 3 P83F 2 P82F 1 P81F 0 P80F
Function
P8xF 0 0 1 1
P8xC 0 1 0 1
P87 function input port output port reserved TB1OUT1
P86 function input port output port reserved TB1OUT0
P85 function input port output port TB1IN1/ INT8 reserved
P84 function input port output port TB1IN0/ INT7 reserved
P83 function input port output port reserved TB0OUT1
P82 function input port output port reserved TB0OUT0
P81 function input port output port TB0IN1/ INT6 reserved
P80 function input port output port TB0IN0/ INT5 reserved
Note: / is bit X of each register P8FC/P8CR.
Page 70
2007-10-10
TMP91FU62
4.9 Port 9 (P90 to P97)
* Port 90 to 95 Port 90 to 95 are a 6-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register are set to "1". In addition to functioning as a I/O port, port 90 to 95 can also function as I/O of SIO0, SIO1. This function enable each function by writing "1" to applicable bit of port 9 function register P9FC. Reset operation initializes P9CR and P9FC to "0", all bits are set to input port. * Port 96 to 97 Port 96 to 97 are a 2-bit general-purpose I/O port. In case of output port, this is open drain output. Reset operation initializes output latch register and control register to "1", and it is set to "High-Z" (High impedance). In addition to functioning as a I/O port, port 96 to 97 can also function as low-frequency oscillator connection pin (XT1 and XT2) during using low speed clock function. Therefore, dual clock function can use by setting of system clock control registers SYSCR0 and SYSCR1.
4.9.1
Port 90 (TXD0/RXD0), 93 (TXD1/RXD0)
In addition to functioning as a I/O port, Port 90 and 93 can also function as TXD output pin or RXD input pin of serial channel. And Port 90 and 93 have a programmable open-drain function which can be controlled by the ODE register.
Direction control (on bit basis) P9CR Function control (on bit basis) Internal data bus P9FC SIO exchange 1
SIOCHG0 S AS B P9 TXD0, TXD1 SB A P9
Open-drain possible: ODE P90 (TXD0) P93 (TXD1)
RXD0, RXD1
Figure 4-15 Port 90 and 93
Page 71
2007-10-10
TMP91FU62
4.9.2
Port 91 (RXD0/TXD0), 94 (RXD1/TXD1)
In addition to functioning as a I/O port, port 91 and 94 can also function as RXD input pin or TXD output pin of serial channel. And Port 91 and 94 have a programmable open-drain function which can be controlled by the SIOCHG0 register.
Direction control (on bit basis) P9CR Internal data bus SIO exchange Open-drain possible: SIOCHG AS B P9 TXD0, TXD1 SB P9 RXD0, RXD1 A P91 (RXD0/TXD0) P94 (RXD1/TXD1)
SIOCHG0 S
Figure 4-16 Port 91 and 94
Page 72
2007-10-10
TMP91FU62
4.9.3
Port 92(CTS0/SCLK0), 95 (CTS1/SCLK1)
In addition to functioning as a I/O port, port 92 and 95 can also function as CTS input pin or SCLK I/O pin of serial channel.
Direction control (on bit basis) P9CR Internal data bus Function control (on bit basis) P9FC S AS B P9 SCLK0, SCLK1 SB P9 CTS0, CTS1 SCLK0, SCLK1 A P92 (SCLK0/CTS0) P95 (SCLK1/CTS1)
Figure 4-17 Port 92 and 95
Page 73
2007-10-10
TMP91FU62
4.9.4
Port 96 (XT1), 97 (XT2)
In addition to functioning as a I/O port, port 96 and 97 can also function as low frequency oscillator connection pins.
Function control (on bit basis)
Direction control (on bit basis)
Internal data bus
Function control (on bit basis)
Direction control (on bit basis)
Figure 4-18 Port 96 and 97
Page 74
2007-10-10
TMP91FU62
Port 9 Register
7 P9 (0024H) Bit symbol Read/Write After reset P97 6 P96 5 P95 4 P94 R/W Data from external port (Output latch register is set to "1".) 3 P93 2 P92 1 P91 0 P90
Port 9 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol P9CR (0026H) Read/Write After reset Function 1 1 0 0 P97C 6 P96C 5 P95C 4 P94C W 0 0 0 0 3 P93C 2 P92C 1 P91C 0 P90C
0: Input 1: Output
Port 9 Function Register (Read-modify-write instructions are prohibited.)
7 Bit Symbol P9FC (0027H) Read/Write After reset 0 Port 0: disable 1: enable P97F 6 P96F W 0 Port 0: disable 1: enable 0 0: port 1: SCLK1 output 5 P95F 4 - - - 0 0: port 1: TXD1 output 3 P93F W 0 0: port 1: SCLK0 output 2 P92F 1 - - - 0 P90F W 0 0: port 1: TXD0 output
Function
P9xF
P9xC
P97 function
P96 function
P95 function input port (SCLK1/ CTS1) output port reserved SCLK1
P94 function input port (RXD1) output port reserved reserved
P93 function
P92 function input port (SCLK0/ CTS0) output port reserved SCLK0
P91 function input port (RXD0) output port reserved reserved
P90 function
0
0
XT2
XT1
input port
input port
0 1 1
1 0 1
reserved input port output port
reserved input port output port
output port reserved TXD1
output port reserved TXD0
Note 1: / is bit X of each register P9FC/P9CR. Note 2: When setting TXD pin to open-drain output, write "1" to bit3 of ODE register (for TXD0 pin), or bit4 (for TXD1 pin). P91/ RXD0 and P94/RXD1 pin does not have a register which changes Port/Function. For example, when it is also used as an input port, the input signal is inputted to SIO as serial receiving data. Note 3: Low frequency oscillation circuit To connect a low frequency resonator to port 96 and 97, it is necessary to set a following procedure to reduce the consumption power supply. (Case of resonator connection) P9CR = "11", P9 = "00" (Case of external clock input) P9CR = "11", P9 = "10"
Page 75
2007-10-10
TMP91FU62
4.10 Port A (PA0 to PA3)
Port A is an 4-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register PA are set to "1". There are the following functions in addition to an I/O port. This function enable each function by writing "1" to applicable bit of port A function register PAFC. *The I/O function of 16-bit timer 2 (TB2IN0,TB2IN1,TB2OUT0,TB2OUT1) *The input function of external interrupt (INT1, INT2) Reset operation initializes, PACR and PAFC to "0", all bits are set to input port.
Direction control (on bit basis) PACR Function control (on bit basis) PAFC S PA0 (TB2IN0/INT1) PA1 (TB2IN1/INT2)
PA
SB A
Internal data bus
PA TB2IN0, INT1 TB2IN1, INT2
Direction control (on bit basis) PACR Function control (on bit basis) PAFC S AS B PA F/F OUT
TB02UT0: TMRB2 TB02UT1: TMRB2
PA2 (TB2OUT0) PA3 (TB2OUT1)
B S
PA
Figure 4-19 Port A
Page 76
2007-10-10
TMP91FU62
Port A Register
7 PA (0028H) Bit symbol Read/Write After reset - - - 6 - - - 5 - - - 4 - - - 3 PA3 2 PA2 R/W Data from external port (Output latch register is set to "1".) 1 PA1 0 PA0
Port A Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol PACR (002AH) Read/Write After reset Function - - - - 6 - - - - 5 - - - - 4 - - - - 0 0 3 PA3C 2 PA2C W 0 0 1 PA1C 0 PA0C
0: Input 1: Output
Port A Function Register (Read-modify-write instructions are prohibited.)
7 Bit symbol PAFC (002BH) Read/Write After reset - - - 6 - - - 5 - - - 4 - - - 0 0: port 1: TB2OUT1 0 0:port 1: TB2OUT0 3 PA3F 2 PA2F W 0 0: port 1: TB2IN1, INT2 0 0: port 1: TB2IN0, INT1 1 PA1F 0 PA0F
Function
-
-
-
-
PAxC 0 0 1 1
PAxF 0 1 0 1
PA3 function input port output port reserved TB2OUT1
PA2 function input port output port reserved TB2OUT0
PA1 function input port output port TB2IN1/ INT2 reserved
PA0 function input port output port TB2IN0/INT1 reserved
Note: / is bit X of each register PAFC/PACR.
Page 77
2007-10-10
TMP91FU62
4.11 Port B (PB0 to PB2)
Port B is an 3-bit general-purpose I/O port. Reset operation initializes to input port. All bits of output latch register PB are set to "1". Reset operation initializes, PBCR to "0", all bits are set to input port.
Reset
Direction control (on bit basis)
Internal data bus
PBCR write Port B PB0 to PB2 Output buffer PB write S B A PB read
Figure 4-20 Port B0 to B2
Page 78
2007-10-10
TMP91FU62
Port B Register
7 PB (002CH) Bit symbol Read/Write After reset - - - 6 - - - 5 - - - 4 - - - 3 - - - 2 PB2 1 PB1 R/W Data from external port (Output latch register is set to "1".) 0 PB0
Port B Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol PBCR (002EH) Read/Write After reset Function - - - - 6 - - - - 5 - - - - 4 - - - - 3 - - - - 0 2 PB2C 1 PB1C W 0 0: Input 1: Output 0 0 PB0C
PBxC 0 1
PB2 function input port output port
PB1 function input port output port
PB0 function input port output port
Note: is bit X of each register PBCR.
Page 79
2007-10-10
TMP91FU62
4.12 Open-drain Control
P30,P31,P41,P90,P93 can perform selection of an open-drain output per bit. Reset operation initializes all bits of the control register ODE to "0" and sets to CMOS output. Open-drain Control Register
7 ODE (003FH) Bit symbol Read/Write After reset Function 6 5 4 ODE93 3 ODE90 2 ODE41 R/W 0 0 0 0 0 1 ODE31 0 ODE30
- - -
- - -
- - -
0: CMOS output 1:Open drain output
4.13 Serial pins switching / Open-drain output Control
TXD pin and RXD pin for a serial channel are interchangeable in P41, P42, P90, P91, P93 and P94. Serial pins switching / Open-drain Control Register 0 (Read-modify-write instructions are prohibited.)
7 SIOCHG0 (0025H) Bit symbol Read/Write After reset 6 5 SIOCHG05 4 SIOCHG04 3 SIOCHG03 W 0 P94 port 0: CMOS output 1: Opendrain output 0 0 0 P91 port 0: CMOS output 1: Opendrain output 0 0 2 SIOCHG02 1 SIOCHG01 0 SIOCHG00
- - -
- - -
Function
0: Setting of P94C 1: TXD1
0: Setting of P93C and P93F 1: RXD1
0: Setting of P91C 1: TXD0
0: Setting of P90C and P90F 1: RXD0
SIOCHG02 0 0
SIOCHG01 0 1
SIOCHG00 0 1
P91 Setting of P91C TXD0 (CMOS output) TXD0 (Open-drain output)
P90 Setting of P90C and P90F RXD0
1
1
1
RXD0
SIOCHG05 0 0
SIOCHG04 0 1
SIOCHG03 0 1
P94 Setting of P94C TXD1 (CMOS output) TXD1 (Open-drain output)
P93 Setting of P93C and P93F RXD1
1
1
1
RXD1
Page 80
2007-10-10
TMP91FU62
Serial pins switching / Open-drain Control Register 1 (Read-modify-write instructions are prohibited.)
7 SIOCHG1 (0015H) Bit symbol Read/Write After reset 6 5 4 SIOCHG14 W 0 P42 port 0: CMOS output 1: Opendrain output 3 2 SIOCHG12 W 0 0 1 SIOCHG11 0
- - -
- - -
- - -
- - -
- - -
Function
0: Setting of P42C 1: TXD2
0: Setting of P41C and P41F2 1: RXD2
SIOCHG14 0 0
SIOCHG12 0 1
SIOCHG11 0 1
P42 Setting of P42C TXD2 (CMOS output) TXD2 (Open-drain output)
P41 Setting of P41C and P41F2 RXD2
1
1
1
RXD2
Page 81
2007-10-10
TMP91FU62
5. 8-Bit Timers (TMRA)
The TMP91FU62 features 4 channels (TMRA0, TMRA1, TMRA4, TMRA5) built-in 8-bit timers. These timers are paired into 2 modules: TMRA01 and TMRA45. Each module consists of 2 channels and can operate in any of the following 4 operating modes. * 8-bit interval timer mode * 16-bit interval timer mode * 8-bit programmable square wave pulse generation output mode (PPG - Variable duty cycle with variable period) * 8-bit pulse width modulation output mode (PWM - Variable duty cycle with constant period) Figure 5-1 to Figure 5-2 show block diagrams for TMRA01 and TMRA45. Each channel consists of an 8-bit up counter, an 8-bit comparator and an 8-bit timer register. In addition, a timer flip-flop and a prescaler are provided for each pair of channels. The operation mode and timer flip-flops are controlled by 5-byte registers SFRs (Special function registers). Each of the three modules (TMRA01 and TMRA45) can be operated independently. All modules operate in the same manner; hence only the operation of TMRA01 is explained here. Table 5-1
Specification Input pin for external clock External pin Output pin for timer flip-flop TA1OUT (Shared with P71) TA01RUN (0100H) TA0REG (0102H) TA1REG (0103H) TA01MOD (0104H) TA1FFCR (0105H) TA5OUT (Shared with P74) TA45RUN (0110H) TA4REG (0112H) TA5REG (0113H) TA45MOD (0114H) TA5FFCR (0115H)
Registers and Pins for Each Module
Module TMRA01 TA0IN (Shared with P70) TMRA45 TA4IN (Shared with P73)
Timer run register
Timer register SFR (Address) Timer mode register
Timer flip-flop control register
Page 82
2007-10-10
Prescaler 2 T1 T4 T16 T256 4 8 16 32 64 128 256 512 Run/clear TA01RUN
5.1 Block Diagrams
Prescaler clock: T0
Selector TA01RUN Selector T1 T4 T16 8-bit up counter (UC1)
n
External input clock: TA0IN 8-bit up counter (UC0) T1 T16 T256
TA01MOD
TA01RUN
Timer flip-flop TA1FF
Timer flip-flop output: TA1OUT TA1FFCR
Figure 5-1 TMRA01 Block Diagram
TA01MOD 2 overflow TA01MOD Match detect TA0TRG
TA01MOD
Page 83
8-bit comparator (CP0) 8-bit timer register TA0REG TA01RUN Register buffer 0 Internal data bus TMRA0 interrupt output: INTTA0 TMRA0 match output: TA0TRG
Match detect 8-bit comparator (CP1)
8-bit timer register TA1REG
Internal data bus
TMRA1 interrupt output: INTTA1
TMP91FU62
2007-10-10
Prescaler 2 T1 T4 T16 T256 4 8 16 32 64 128 256 512 Run/clear TA45RUN
Prescaler clock: T0
Selector TA45RUN Selector T1 T4 T16
n
External input clock: TA4IN 8-bit up counter (UC4) T1 T16 T256
TA45MOD
TA45RUN 8-bit up counter (UC5)
Timer flip-flop TA5FF
Timer flip-flop output: TA5OUT TA5FFCR
Figure 5-2 TMRA45 Block Diagram
TA45MOD 2 overflow TA45MOD Match detect TA4TRG
TA45MOD
Page 84
8-bit comparator (CP4) 8-bit timer register TA4REG TA45RUN Register buffer 4 Internal data bus TMRA4 interrupt output: INTTA4 TMRA4 match output: TA4TRG
Match detect 8-bit comparator (CP5)
8-bit timer register TA5REG
Internal data bus
TMRA5 interrupt output: INTTA5
TMP91FU62
2007-10-10
TMP91FU62
5.2 Operation of Each Circuit
5.2.1 Prescalers
A 9-bit prescaler generates the input clock to TMRA01. The "T0" as the input clock to prescaler is a clock divided by 4 which is selected using the prescaler clock selection register SYSCR0. The prescaler's operation can be controlled using TA01RUN in the timer control register. Setting to "1" starts the count; setting to "0" clears the prescaler to "0" and stops operation. Table 5-2 shows the various prescaler output clock resolutions. Table 5-2 Prescaler Output Clock Resolution
@ fc = 20 MHz, fs = 32.768 kHz System Clock Selection SYSCR1 1 (fs) Prescaler Clock Selection SYSCR0 Prescaler Output Clock Resolution T1 (1/2) 23/fs (244 s) 23/fc (0.4 s) 0 (1/1) fFPH 24/fc (0.8 s) 25/fc (1.6 s) 26/fc (3.2 s) 27/fc (6.4 s) 1 (1/16) fc/16 CLOCK 27/fc (6.4 s) T4 (1/8) 25/fs (977 s) 25/fc (1.6 s) 26/fc (3.2 s) 27/fc (6.4 s) 28/fc (12.8 s) 29/fc (25.6 s) 29/fc (25.6 s) T16 (1/32) 27/fs (3.9 ms) 27/fc(6.4 s) 28/fc (12.8 s) 29/fc (25.6 s) 210/fc (51.2 s) 211/fc (102.4 s) 211/fc (102.4 s) T256 (1/512) 211/fs (62.5 ms) 211/fc (102.4 s) 212/fc (204.8 s) 213/fc (409.6 s) 214/fc (819.2 s) 215/fc (1638.4 s) 215/fc (1638.4 s)
Gear Value SYSCR1
XXX 000 (fc) 001 (fc/2) 010 (fc/4)
0 (fc)
011 (fc/8) 100 (fc/16) XXX
Note: xxx: Don't care
5.2.2
Up counters (UC0 and UC1)
These are 8-bit binary counters which count up the input clock pulses for the clock specified by TA01MOD. The input clock for UC0 is selectable and can be either the external clock input via the TA0IN pin or one of the three internal clocks T1, T4, or T16. The clock setting is specified by the value set in TA01MOD. The input clock for UC1 depends on the operation mode. In 16-bit timer mode, the overflow output from UC0 is used as the input clock. In any mode other than 16-bit timer mode, the input clock is selectable and can either be one of the internal clocks T1, T16 or T256, or the comparator output (The match detection signal) from TMRA0. For each interval timer the timer operation control register bits TA01RUN and TA01RUN can be used to stop and clear the up counters and to control their count. A reset clears both up counters, stopping the timers.
Page 85
2007-10-10
TMP91FU62
5.2.3
Timer registers (TA0REG and TA1REG)
These are 8-bit registers which can be used to set a time interval. When the value set in the timer register TA0REG or TA1REG matches the value in the corresponding up counter, the comparator match detect signal goes active. If the value set in the timer register is 00H, the signal goes active when the up counter overflows. The TA0REG are double buffer structure, each of which makes a pair with register buffer. The setting of the bit TA01RUN determines whether TA0REG's double buffer structure is enabled or disabled. It is disabled if = "0" and enabled if = "1". When the double buffer is enabled, data is transferred from the register buffer to the timer register when a 2n overflow occurs in PWM mode, or at the start of the PPG cycle in PPG mode. Hence the double buffer cannot be used in timer mode. A reset initializes to "0", disabling the double buffer. To use the double buffer, write data to the timer register, set to "1", and write the following data to the register buffer. Figure 5-3 shows the configuration of TA0REG.
Timer registers 0 (TA0REG)
B Y
Selector A
Shift trigger Register buffers 0 Write Internal data bus
Matching detection in PPG cycle 2n overflow PWM Write to TA0REG
S
TA01RUN
Figure 5-3 Configuration of TA0REG
Note:The same memory address is allocated to the timer register TA0REG and the register buffer 0. When = 0, the same value is written to the register buffer 0 and the timer register TA0REG; when = 1, only the register buffer 0 is written to.
Page 86
2007-10-10
TMP91FU62
5.2.4
Comparator (CP0 and CP1)
The comparator compares the value in an up counter with the value set in a timer register. If they match, the up counter is cleared to 0 and an interrupt signal (INTTA0 or INTTA1) is generated. If timer flip-flop inversion is enabled, the timer flip-flop is inverted at the same time.
Note:If a value smaller than the up-counter value is written to the timer register while the timer is counting up, this will cause the timer to overflow and an interrupt cannot be generated at the expected time. (The value in the timer register can be changed without any problem if the new value is larger than the up-counter value.) In 16bit interval timer mode, be sure to write to both TA0REG and TA1REG in this order (16 bits in total), The compare circuit will not function if only the lower 8 bits are set.
5.2.5
Timer flip-flop (TA1FF)
The timer flip-flop (TA1FF) is a flip-flop inverted by the match detects signal (8-bit comparator output) of each interval timer. Whether inversion is enabled or disabled is determined by the setting of the bit TA1FFCR in the timer flip-flop control register. A reset clears the value of TA1FF1 to "0". Writing "01" or "10" to TA1FFCR sets TA1FF to 0 or 1. Writing "00" to these bits inverts the value of TA1FF (This is known as software inversion). The TA1FF signal is output via the TA1OUT pin (Concurrent with P71). When this pin is used as the timer output, the timer flip-flop should be set beforehand using the port 7 function registers P7CR, P7FC.
The condition for TA1FF inversion varies with mode as shown below
8-bit interval timer mode 16-bit interval timer mode 8 bit PWM mode 8 bit PPG mode : UC0 matches TA0REG or UC1 matches TA1REG (Select either one of the two) : UC0 matches TA0REG or UC1 matches TA1REG : UC0 matches TA0REG or a 2n overflow occurs : UC0 matches TA0REG or UC0 matches TA1REG
Note: If an inversion by the match-detect signal and a setting change via the TMRA1 flip-flop control register occur simultaneously, the resultant operation varies depending on the situation, as shown below.
* If an inversion by the match-detect signal and an inversion via the register occur simultaneously, the flip-flop will be
inverted only once.
* If an inversion by the match-detect signal and an attempt to set the flip-flop to 1 via the register occur simultaneously, the timer flip-flop will be set to 1. * If an inversion by the match-detect signal and an attempt to clear the flip-flop to 0 via the register occur simultaneously the flip-flop will be cleared to 1.
Be sure to stop the timer before changing the flip-flop insertion setting. If the setting is changed while the timer is counting, proper operation cannot be obtained.
Page 87
2007-10-10
TMP91FU62
5.3 SFR
TMRA01 Run Register
7 Bit symbol TA01RUN (0100H) Read/Write After Reset TA0RDE R/W 0 Double buffer 0: Disable 1: Enable 6 - - - 5 - - - 4 - - - 0 0 TMRA01 prescaler 3 I2TA01 2 TA01PRUN R/W 0 Up counter (UC1) 0 Up counter (UC0) 1 TA1RUN 0 TA0RUN
Function
IDLE2 0: Stop 1: Operate
0: Stop and clear 1: Run (count up)
Count operation
TA01PRUN TA1RUN / TA0RUN 0 1 Stop and clear
TA0REG double buffer control
0 TA0RDE Run (Count up) 1 Enable Disable
Note: The values of bits 4 to 6 of TA01RUN are "1" when read.
TMRA45 Run Register
7 Bit symbol TA45RUN (0110H) Read/Write After Reset TA4RDE R/W 0 Double buffer 0: Disable 1: Enable 6 - - - 5 - - - 4 - - - 0 0 TMRA45 prescaler 3 I2TA45 2 TA45PRUN R/W 0 Up counter (UC5) 0 Up counter (UC4) 1 TA5RUN 0 TA4RUN
Function
IDLE2 0: Stop 1: Operate
0: Stop and clear 1: Run (count up) TA4REG double buffer control
Count operation
TA45PRUN TA5RUN / TA4RUN 0 1 Stop and clear
0 TA4RDE 1
Disable Enable
Run (Count up)
Note: The values of bits 4 to 6 of TA45RUN are "1" when read.
Page 88
2007-10-10
TMP91FU62
TMRA01 Mode Register
7 Bit symbol TA01MOD (0104H) Read/Write After reset 0 Operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit PPG mode 11: 8-bit PWM mode 0 0 PWM cycle 00: Reserved 01: 26 10: 27 11: 28 0 TA01M1 6 TA01M0 5 PWM01 4 PWM00 R/W 0 0 0 0 3 TA1CLK1 2 TA1CLK0 1 TA0CLK1 0 TA0CLK0
Function
Input clock for TMRA1 00: TA0TRG 01: T1 10: T16 11: T256
Input clock for TMRA0 00: TA0IN pin 01: T1 10: T4 11: T16
TMRA0 input clock selection
00 01 10 11 TA0IN T1 T4 T16
TMRA1 input clock selection
TA01MOD 01 00 01 10 11 Comparator output from TMRA0 T1 T16 T256 Overflow output from TMRA0 (16-bit timer mode) TA01MOD = 01
PWM cycle selection
00 01 10 11 Reserved 26 x Clock source 27 x Clock source 28 x Clock source
TMRA01 operation mode selection
00 01 10 11 8-bit PPG 8-bit PWM (TMRA0) + 8-bit timer (TMRA1) 8-bit timers 2ch 16-bit timer
Page 89
2007-10-10
TMP91FU62
TMRA45 Mode Register
7 Bit symbol TA45MOD (0114H) Read/Write After reset 0 Operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit PPG mode 11: 8-bit PWM mode 0 0 PWM cycle 00: Reserved 01: 26 10: 27 11: 28 0 TA45M1 6 TA45M0 5 PWM41 4 PWM40 R/W 0 0 0 0 3 TA5CLK1 2 TA5CLK0 1 TA4CLK1 0 TA4CLK0
Function
Input clock for TMRA5 00: TA4TRG 01: T1 10: T16 11: T256
Input clock for TMRA4 00: TA4IN pin 01: T1 10: T4 11: T16
TMRA4 input clock selection
00 01 10 11 TA4IN T1 T4 T16
TMRA5 input clock selection
TA45MOD 01 00 01 10 11 Comparator output from TMRA4 T1 T16 T256 Overflow output from TMRA4 (16-bit timer mode) TA45MOD = 01
PWM cycle selection
00 01 10 11 Reserved 26 x Clock source 27 x Clock source 28 x Clock source
TMRA45 operation mode selection
00 01 10 11 8-bit PPG 8-bit PWM (TMRA4) + 8-bit timer (TMRA5) 8-bit timers 2ch 16-bit timer
Page 90
2007-10-10
TMP91FU62
TMRA1 Flip-Flop Control Register
7 Bit symbol TA1FFCR (0105H) Read/Write After reset - - - 6 - - - 5 - - - 4 - - - 1 00: Invert TA1FF 01: Set TA1FF 10: Clear TA1FF 11: Don't care 3 TA1FFC1 R/W 1 0 TA1FF control for inversion 0: Disable 1: Enable 2 TA1FFC0 1 TA1FFIE R/W 0 TA1FF inversion select 0: TMRA0 1:TMRA1 0 TA1FFIS
Function
Inverse signal for timer flip-flop 1 (TA1FF) (Don't care except in 8-bit timer mode)
0 TA1FFIS 1 Inversion by TMRA1 Inversion by TMRA0
Inversion of TA1FF
0 TA1FFIE 1 Enabled Disabled
Control of TA1FF
00 01 10 11 Clears TA1FF to "0" Don't care Inverts the value of TA1FF (Software inversion) Sets TA1FF to "1"
Note: The values of bits 4 to 7 of TA1FFCR are "1" when read.
TMRA5 Flip-Flop Control Register
7 Bit symbol TA5FFCR (0115H) Read/Write After reset - - - 6 - - - 5 - - - 4 - - - 1 00: Invert TA5FF 01: Set TA5FF 10: Clear TA5FF 11: Don't care 3 TA5FFC1 R/W 1 0 TA5FF control for inversion 0: Disable 1: Enable 2 TA5FFC0 1 TA5FFIE R/W 0 TA5FF inversion select 0: TMRA4 1:TMRA5 0 TA5FFIS
Function
Inverse signal for timer flip-flop 5 (TA5FF) (Don't care except in 8-bit timer mode)
0 TA5FFIS 1 Inversion by TMRA5 Inversion by TMRA4
Inversion of TA5FF
0 TA5FFIE 1 Enabled Disabled
Control of TA5FF
00 01 10 11 Clears TA5FF to "0" Don't care Inverts the value of TA5FF (Software inversion) Sets TA5FF to "1"
Note: The values of bits 4 to 7 of TA5FFCR are "1" when read.
Page 91
2007-10-10
TMP91FU62
Timer Register
7 Bit symbol TA0REG (0102H) Read/Write After Reset Bit symbol TA1REG (0103H) Read/Write After Reset Bit symbol TA4REG (0112H) Read/Write After Reset Bit symbol TA5REG (0113H) Read/Write After Reset 6 5 4 - W 0 - W 0 - W 0 - W 0 3 2 1 0
Page 92
2007-10-10
TMP91FU62
5.4 Operation in Each Mode
5.4.1 8-bit timer mode
Both TMRA0 and TMRA1 can be used independently as 8-bit interval timers. Set its function or counter data for TMRA0 and TMRA1 after stop these registers.
5.4.1.1
Generating interrupts at a fixed interval (Using TMRA1)
To generate interrupts at constant intervals using TMRA1 (INTTA1), first stop TMRA1 then set the operation mode, input clock and a cycle to TA01MOD and TA1REG register, respectively. Then, enable the interrupt INTTA1 and start TMRA1 counting. Example: To generate an INTTA1 interrupt every 12 s at fc = 20 MHz, set each register as follows:
* Clock state System clock Prescaler clock Clock gear : High frequency (fc) : fFPH : 1 (fc)
MSB 7 TA01RUN TA01MOD TA1REG INTETA01 TA01RUN - 0 0 X - 6 X 0 0 1 X 5 X X 0 0 X 4 X X 1 1 X 3 - 0 1 X - 2 - 1 1 - 1 1 0 X 1 - 1
LSB 0 - X 0 - - Stop TMRA1 and clear it to 0. Select 8-bit timer mode and select T1 (0.4 s at fc = 20 MHz) as the input clock. Set TA1REG to 12 s / T1 = 30 = 1EH Enable INTTA1 and set it to level 5. Start TMRA1 counting.
Note: X: Don't care, -: No change
Select the input clock using Table 5-2.
Note: The input clocks for TMRA0 and TMRA1 are different from as follows. TMRA0: TA0IN input, T1, T4 or T16 TMRA1: Match output of TMRA0, T1, T16, T256
Page 93
2007-10-10
TMP91FU62
5.4.1.2
Generating a 50% duty ratio square wave pulse
The state of the timer flip-flop (TA1FF) is inverted at constant intervals and its status output via the timer output pin (TA1OUT). Example: To output a 2.4 s square wave pulse from the TA1OUT pin at fc = 20 MHz, use the following procedure to make the appropriate register settings. This example uses TMRA1; however, either TMRA0 or TMRA1 may be used.
* Clock state System clock Prescaler clock Clock gear : High frequency (fc) : fFPH : 1 (fc)
MSB 7 TA01RUN TA01MOD TA1REG TA1FFCR P7CR P7FC TA01RUN - 0 0 X X X - 6 X 0 0 X X X X 5 X X 0 X X X X 4 X X 0 X - - X 3 - 0 0 1 - - - 2 - 1 0 0 - - 1 1 0 - 1 1 1 1 1
LSB 0 - - 1 1 - Set P71 to function as the TA1OUT pin. - - Start TMRA1 counting. Stop TMRA1 and clear it to 0. Select 8-bit timer mode and select T1 (0.4 s at fc = 20 MHz) as the input clock. Set the timer register to 2.4 s / T1 / 2 = 03H Clear TA1FF to "0" and set it to invert on the match detects signal from TMRA1.
Note: X: Don't care, -: No change
Page 94
2007-10-10
TMP91FU62
T1 TA01RUN Bits 7 to 2
Up counter Bit1 0 1 2 3 0 1 2 3 0 1 2 3 0
Bit0 Comparator timig Comparator output (Match detect) INTTA1 UC1 clear
TA1FF
TA1OUT 0.9 s at fc = 20 MHz
Figure 5-4 Square Wave Output Timing Chart (50% duty)
5.4.1.3
Making TMRA1 count up on the match signal from the TMRA0 comparator
Select 8-bit timer mode and set the comparator output from TMRA0 to be the input clock to TMRA1.
Comparator output (TMRA0 match)
TMRA0 up counter (when TA0REG = 5) TMRA1 up counter (when TA1REG = 2)
1
2
3
4
5
1
2
3
4
5
1
2
3
1
2
1
TMRA1 match output
Figure 5-5 TMRA1 Count Up on Signal from TMRA0
Page 95
2007-10-10
TMP91FU62
5.4.2
16-bit timer mode
A 16-bit interval timer is configured by pairing the two 8-bit timers TMRA0 and TMRA1. To make a 16-bit interval timer in which TMRA0 and TMRA1 are cascaded together, set TA01MOD to 01. In 16-bit timer mode, the overflow output from TMRA0 is used as the input clock for TMRA1, regardless of the value set in TA01MOD. Table 5-2 shows the cycle of the input clock for TMRA0. LSB 8-bit set to TA0REG and MSB 8-bit is for TA1REG. Please keep setting TA0REG first because setting data for TA0REG inhibit its compare function and setting data for TA1REG permit it. Example: To generate an INTTA1 interrupt every 0.4 [s] at fc = 20 MHz, set the timer registers TA0REG and TA1REG as follows:
* Clock state System clock Prescaler clock Clock gear : High frequency (fc) : fFPH : 1 (fc)
If T16 (27/fc s at fc = 20 MHz) is used as the input clock for counting, set the following value in the registers: 0.4 s/(27/fc) s 62500 = F424H (e.g., set TA1REG to F4H and TA0REG to 24H). As a result, INTTA1 interrupt can be generated every 0.4 [s]. The comparator match signal is output from TMRA0 each time the up counter UC0 matches TA0REG, though the up counter UC0 is not cleared and also INTTA0 is not generated. In the case of the TMRA1 comparator, the match detect signal is output on each comparator pulse on which the values in the up counter UC1 and TA1REG match. When the match detect signal is output simultaneously from both the comparators TMRA0 and TMRA1, the up counters UC0 and UC1 are cleared to 0 and the interrupt INTTA1 is generated. Also, if inversion is enabled, the value of the timer flip-flop TA1FF is inverted. Example: When TA1REG = 04H and TA0REG = 80H
Value of up counter (UC1, UC0) TMRA0 comparator match detect signal TMRA1 comparator match detect signal Interrupt INTTA0 Interrupt INTTA1
0080H
0180H
0280H
0380H
0480H
0080H
Timer output TA1OUT
Inversion
Figure 5-6 Timer Output by 16-Bit Timer Mode
Page 96
2007-10-10
TMP91FU62
5.4.3
8-bit PPG (Programmable pulse generation) output mode
Square wave pulses can be generated at any frequency and duty ratio by TMRA0. The output pulses may be active low or active high. In this mode TMRA1 cannot be used. TMRA0 outputs pulses on the TA1OUT pin.
tH = "10" t tL = "01" t tH tL
Example: = "01"
TA0REG and UC0 match (Interrupt INTTA0) TA1REG and UC0 match (Interrupt INTTA1)
TA1OUT TA0REG TA1REG
Figure 5-7 8-Bit PPG Output Waveforms
In this mode, a programmable square wave is generated by inverting the timer output each time the 8-bit up counter (UC0) matches the value in one of the timer registers TA0REG or TA1REG. The value set in TA0REG must be smaller than the value set in TA1REG. Although the up counter for TMRA1 (UC1) is not used in this mode, TA01RUN should be set to "1", so that UC1 is set for counting. Figure 5-8 shows a block diagram representing this mode.
TA1OUT TA01RUN
Selector
TA0IN T1 T4 T16 TA01MOD
TA1FF 8-bit up counter (UC0)
TA1FFCR
Inversion
INTTA0
Comparator
Comparator
INTTA1
Selector TA0REG-WR
TA0REG
Shift trigger
Register buffer TA01RUN
TA1REG
Internal data bus
Figure 5-8 Block Diagram of 8-Bit PPG Output Mode
Page 97
2007-10-10
TMP91FU62
If the TA0REG double buffer is enabled in this mode, the value of the register buffer will be shifted into TA0REG each time TA1REG matches UC0. Use of the double buffer facilitates the handling of low-duty waves (when duty is varied).
Match with TA0REG and up counter
(Up counter = Q1) Match wiht TA1REG Shift from register buffer 0 TA0REG (Value to be compared) Register buffer (Up counter = Q2)
Q1 Q2
Q2 Q3
TA0REG (Register buffer 0) write
Figure 5-9 Operation of Register Buffer 0
Note:The values that can be set in TAxREG range from 01h to 00h (equivalent to 100h). If the maximum value 00h is set, the match-detect signal goes active when the up-counter overfolws.
Example: To generate 1/4-duty 50-kHz pulses (at fc = 20 MHz):
20
s
* Clock state
System clock Prescaler clock Clock gear
: High frequency (fc) : fFPH : 1 (fc)
Calculate the value which should be set in the timer register. To obtain a frequency of 50 kHz, the pulse cycle t should be: t = 1/50 kHz = 20 s T1 = 23/fc s (at fc = 20 MHz); 20 s/(23/fc) s = 50 Therefore set TA1REG to 50 (32H), and 50-kHz pulses can be obtained. The duty is to be set to 1/4: t x 1/4 = 20 s x 1/4 = 5 s 5 s/(23/fc) s 13 Therefore, set TA0REG = 13 = 0DH.
Page 98
2007-10-10
TMP91FU62
7 TA01RUN TA01MOD TA0REG TA1REG TA1FFCR 0 1 0 0 X
6 X 0 0 0 X
5 X X 0 1 X
4 X X 0 1 X
3 - X 1 0 0
2 - X 1 0 1
1 0 0 0 1 1
0 0 1 1 0 X Stop TMRA0 and TMRA01 and clear it to "0".(Double buffer disable) Set the 8-bit PPG mode, and select T1 as input clock. Write 0DH. Write 32H. Set TA1FF, enabling both inversion and the double buffer. Writing "10" provides negative logic pulse.
P7CR P7FC TA01RUN
X X 1
X X X
X X X
- - X
- - -
- - 1
1 1 1
- Set P71 as the TA1OUT pin. - 1 Start TMRA0 and TMRA01 counting.(Double buffer enable)
Note:X : Don't Care - : No change
Page 99
2007-10-10
TMP91FU62
5.4.4
8-bit PWM output mode
This mode is only valid for TMRA0. In this mode, a PWM pulse with the maximum resolution of 8 bits can be output. When TMRA0 is used the PWM pulse is output on the TA1OUT pin. TMRA1 can also be used as an 8-bit timer. The timer output is inverted when the up counter (UC0) matches the value set in the timer register TA0REG or when 2n counter overflow occurs (n = 6, 7 or 8 as specified by TA01MOD). The up counter UC0 is cleared when 2n counter overflow occurs. The following conditions must be satisfied before this PWM mode can be used. Value set in TA0REG < Value set for 2n counter overflow Value set in TA0REG 0
TA0REG and UC0 match 2n overflow (INTTA0 interrupt) TA1OUT tPWM (PWM cycle)
Figure 5-10 8-Bit PWM Waveforms
Figure 5-11 shows a block diagram representing this mode.
Selector
TA0IN T1 T4 T16 8-bit up counter (UC0)
TA01RUN
TA1OUT
Clear 2n overflow control Overflow
TA1FF
Invert TA01MOD
TA1FFCR
TA01MOD
Comparator
INTTA0
Selector TA0REG-WR
TA0REG
Shift trigger
Register buffer0 TA01RUN Internal data bus
Figure 5-11 Block Diagram of 8-Bit PWM Mode
In this mode, the value of the register buffer will be shifted into TA0REG if 2n overflow is detected when the TA0REG double buffer is enabled. Page 100
2007-10-10
TMP91FU62
Use of the double buffer facilitates the handling of low duty ratio waves.
Match with TA0REG
(Up counter = Q1) 2n overflow (Up counter = Q2)
Shift into TA0REG
TA0REG (Value to be compared) Register buffer 0
Q1 Q2
Q2 Q3
TA0REG (Register buffer 0) write
Figure 5-12 Operation of Register Buffer 0
Example: To output the following PWM waves on the TA1OUT pin at fc = 20 MHz:
* Clock state
System clock Prescaler clock Clock gear
: High frequency (fc) : fFPH : 1 (fc)
To achieve a 51.2 s PWM cycle by setting T1 to 23/fc s (at fc = 20 MHz): 51.2 s/(23/fc) s 128 = 2n Therefore n should be set to 7. Since the low-level period is 29.6 s when T1 = 23/fc s (at fc = 20 MHz), set the following value for TA0REG: 29.6 s/(23/fc) s 74 = 4AH
MSB 7 TA01RUN TA01MOD TA0REG TA1FFCR P7CR P7FC TA01RUN - 1 0 X X X 1 6 X 1 1 X X X X 5 X 1 0 X X X X 4 X 0 0 X - - X 3 - - 1 1 - - - 2 - - 0 0 - - 1 1 - 0 1 1 1 1 -
LSB 0 0 1 0 X - Set P71 and the TA1OUT pin. - 1 Start TMRA0 counting. Stop TMRA0 and clear it to 0. Select 8-bit PWM mode (Cycle: 27) and select T1 as the input clock. Write 4AH. Clear TA1FF to 0, enable the inversion and double buffer.
Note:X : Don't Care - : No change
Page 101
2007-10-10
TMP91FU62
Table 5-3 PWM Cycle
Select System Clock SYSCR1 1 (fs) Gear Value SYSCR1 XXX 000 (fc) 001 (fc/2) 010 (fc/4) 0 (fc) 011 (fc/8) 100 (fc/16) XXX 1 (1/16) fc/16 clock 0 (1/1) fFPH Select Prescaler Clock SYSCR0 PWM cycle 26 T1 15.6 ms 25.6 s 51.2 s 102.4 s 204.8 s 409.6 s 409.6 s T4 62.5 ms 102.4 s 204.8 s 409.6 s 819.2 s 1638 s 1638 s T16 250 ms 409.6 s 819.2 s 1638 s 3277 s 6554 s 6554 s T1 31.3 ms 51.2 s 102.4 s 204.8 s 409.6 s 819.2 s 819.2 s 27 T4 125 ms 204.8 s 409.6 s 810.2 s 1638 s 3277 s 3277 s
@ fc = 20 MHz, fs = 32.768 kHz
28 T16 500 ms 819.2 s 1638 s 3277 s 6554 s 13107 s 13107 s T1 62.5 ms 102.4 s 204.8 s 409.6 s 819.2 s 1638 s 1638 s T4 250 ms 409.6 s 819.2 s 1638 s 3277 s 6554 s 6554 s T16 1000 ms 1638 s 3277 s 6554 s 13107 s 26214 s 26214 s
Note: xxx: Don't care
5.4.5
Settings for each mode
Table 5-4 shows the SFR settings for each mode.
Table 5-4 Timer Mode Setting Registers
Register Name Function Timer Mode PWM Cycle TA01MOD Upper Timer Input Clock Lower timer match T1, T16, T256 (00, 01, 10, 11) Lower Timer Input Clock External clock T1 T4, T16 (00, 01, 10, 11) External clock T1, T4, T16 (00, 01, 10, 11) External clock T1, T4, T16 (00, 01, 10, 11) External clock T1, T4, T16 (00, 01, 10, 11) - TA1FFCR TA1FFIS Timer F/F Invert Signal Select 0: Lower timer output 1: Upper timer output
8-bit timer x 2 channels
00
-
16-bit timer mode
01
-
-
-
8-bit PPG x 1 channel
10
-
-
-
8-bit PWM x 1 channel
11
26, 27, 28 (01, 10, 11)
-
-
8-bit timer x 1 channel
11
-
T1, T16, T256 (01, 10, 11)
Output disabled
Note: - : Don't care
Page 102
2007-10-10
TMP91FU62
6. 16-Bit Timer/Event Counters (TMRB)
The TMP91FU62 incorporates four multifunctional 16-bit timer/event counters (TMRB0, TMRB1, TMRB2, TMRB3) which have the following operation modes: * 16-bit interval timer mode * 16-bit event counter mode * 16-bit programmable pulse generation (PPG) output mode The capture function enables selection of the following modes: * Frequency measurement mode * Pulse width measurement mode * Time differential measurement Figure 6-1 show block diagrams for TMRB0, TMRB1, TMRB2 and TMRB3. Each timer/event counter channel consists of a 16-bit up-counter, two 16-bit timer registers (one of them with a double-buffer structure), two 16-bit capture registers, two comparators, a capture input controller, two timer flipflops and a timer flip-flop controller. Each timer/event counter is controlled by an 11-byte SFR (special-function register). Each of the four channels (TMRB0, TMRB1, TMRB2, TMRB3) can be used independently. Each channel features the same operations except for those described in Table 6-1. Hence, only the operation of TMRB0 is explained below. Table 6-1 Registers and Pins for TMRB
Channel TMRB0 Specification TB0IN0 (also used as P80) TB0IN1 (also used as P81) TB0OUT0 (also used as P82) TB0OUT1 (also used as P83) TB0RUN (0180H) TB0MOD (0182H) TB0FFCR (0183H) TB0RG0L (0188H) SFR (address) TB0RG0H (0189H) Timer registers TB0RG1L (018AH) TB0RG1H (018BH) TB0CP0L (018CH) TB0CP0H (018DH) Capture registers TB0CP1L (018EH) TB0CP1H (018FH) capture of TMRA Capture timing of TMRA TA1OUT TB1CP1L (019EH) TB1CP1H (019FH) TA1OUT TB2CP1L (01AEH) TB2CP1H (01AFH) TA1OUT TB3CP1L (01BEH) TB3CP1H (01BFH) Don't care TB1RG1L (019AH) TB1RG1H (019BH) TB1CP0L (019CH) TB1CP0H (019DH) TB2RG1L (01AAH) TB2RG1H (01ABH) TB2CP0L (01ACH) TB2CP0H (01ADH) TB3RG1L (01BAH) TB3RG1H (01BBH) TB3CP0L (01BCH) TB3CP0H (01BDH) TB1IN0 (also used as P84) TB1IN1 (also used as P85) TB1OUT0 (also used as P86) TB1OUT1 (also used as P87) TB1RUN (0190H) TB1MOD (0192H) TB1FFCR (0193H) TB1RG0L (0198H) TB1RG0H (0199H) TB2IN0 (also used as PA0) TB2IN1 (also used as PA1) TB2OUT0 (also used as PA2) TB2OUT1 (also used as PA3) TB2RUN (01A0H) TB2MOD (01A2H) TB2FFCR (01A3H) TB2RG0L (01A8H) TB2RG0H (01A9H) TB3IN0 (also used as P30) TB3IN1 (also used as P31) TB3OUT0 (also used as P32) TB3OUT1 (also used as P33) TB3RUN (01B0H) TB3MOD (01B2H) TB3FFCR (01B3H) TB3RG0L (01B8H) TB3RG0H (01B9H) TMRB1 TMRB2 TMRB3
External clock/capture trigger input pins External pins Timer flip-flop output pins
Timer run register Timer mode register Timer flip-flop control register
Page 103
2007-10-10
Internal data bus Internal data bus
Run/ clear TBnRUN
INT output INTTBn0 INTTBn1
6.1 Block Diagrams
Prescaler clock: T0 2 T1
TBnMOD Capture, external INT input control Timer flip-flop control TBnRUN TBnMOD Selector Count clock 16-bit up-counter (UCn) TBnMOD
4 T4 T16
Capture register 0 TBnCP0H/L Capture register 1 TBnCP1H/L
8 16 32
External INT input INTx INTy
Timer flip-flop TBnFF0 TBnFF1
TAzOUT (From TMRA) TBnIN0 TBnIN1
Timer flip-flop output TBnOUT0 TBnOUT1
Figure 6-1 Block Diagrams of TMRB0 to TMRB3
T1 T4 T16
TBnMOD
Match detection
Page 104
16-bit comparator (CPn0) 16-bit timer register TBnRG0H/L 16-bit comparator (CPn1) 16-bit timer register TBnRG1H/L TBnRUN Register buffer
Overflow interrupt INTTBOFn
Timer TMRB0 TMRB1 TMRB2 TMRB3
Match detection
n 0 1 2 3
INTx INT5 INT7 INT1 INT3
INTy INT6 INT8 INT2 INT4
TAzOUT TA1OUT TA1OUT TA1OUT
TMP91FU62
Internal data bus
Internal data bus
2007-10-10
TMP91FU62
6.2 Operation of Each Block
6.2.1 Prescaler
The 5-bit prescaler generates the source clock for TMRB0. The prescaler clock (T0) is divided clock (divided by 4) from selected clock by the register SYSCR0 of clock gear. This prescaler can be started or stopped using TB0RUN. Counting starts when is set to 1; the prescaler is cleared to 0 and stops operation when is cleared to 0. Table 6-2 show prescaler output clock resolution. Table 6-2 Prescaler Output Clock Resolution
Clock Gear Value SYSCR1 Prescaler Clock Selection
@fc = 20 MHz, fs = 32.768 kHz
Prescaler Output Clock Resolution T1 (1/2) 23/fs (244 s) 23/fc (0.4 s) T4 (1/8) 25/fs (977 s) 25/fc (1.6 s) 26/fc (3.2 s) 27/fc (6.4 s) 28/fc (12.8 s) 29/fc (25.6 s) 29/fc (25.6 s) T16 (1/32) 27/fs (3.9 ms) 27/fc(6.4 s) 28/fc (12.8 s) 29/fc (25.6 s) 210/fc (51.2 s) 211/fc (102.4 s) 211/fc (102.4 s)
System Clock SelectionSYSC1< SYSCK> 1 (fs)
XXX 000 (fc) 001 (fc/2) 010 (fc/4) 0 (1/1) fFPH
24/fc (0.8 s) 25/fc (1.6 s) 26/fc (3.2 s) 27/fc (6.4 s)
0 (fc)
011 (fc/8) 100 (fc/16) XXX 1 (1/16) fc/16 clock
27/fc (6.4 s)
Note: xxx: Don't care
6.2.2
Up counter (UC0)
UC0 is a 16-bit binary counter which counts up according to input from the clock specified by TB0MOD register. As the input clock, one of the prescaler internal clocks T1, T4 and T16 or an external clock from TB0IN0 pin can be selected. Counting or stopping and clearing of the counter is controlled by timer operation control register TB0RUN. When clearing is enabled, the up counter UC0 will be cleared to 0 each time its value matches the value in the timer register TB0RG1H/L. If clearing is disabled, the counter operates as a free-running counter. Clearing can be enabled or disabled by using TB0MOD. A timer overflow interrupt (INTTBOF0) is generated when UC0 overflow occurs.
6.2.3
Timer registers (TB0RG0H/L, TB0RG1H/L)
These two 16-bit registers are used to set the interval time. When the value in the up counter UC0 matches the value set in this timer register, the comparator match detect signal will go active. Setting data for both upper and lower timer registers is needed. For example, using 2-byte data transfer instruction or using 1-byte data transfer instruction twice for lower 8 bits and upper 8 bits in order. (The compare circuit will not operate if only the lower 8 bits are written. Be sure to write to both timer registers (16 bits) from the lower 8 bits followed by the upper 8 bits.) The TB0RG0H/L timer register has a double-buffer structure, which is paired with register buffer 0. The value set in TB0RUN determines whether the double-buffer structure is enabled or disabled: it is disabled when = "0", and enabled when = "1".
Page 105
2007-10-10
TMP91FU62
When the double buffer is enabled, data is transferred from the register buffer 0 to the timer register when the values in the up counter (UC0) and the timer register TB0RG1H/L match. The double buffer circuit incorporates two flags to indicate whether or not data is written to the lower 8 bits and the upper 8 bits of the register buffer, respectively. Only when both flags are set can data be transferred from the register buffer to the timer register by a match between the up-counter UC0 and the timer register TB0RG1. This data transfer is performed so long as 16-bit data is written in the register buffer regardless of the register buffer to the timer register unexpectedly as explained below. For example, let us assume that an interrupt occurs when only the lower 8 bits (L1) of the register buffer data (H1L1) have been written and the interrupt routine includes writes to all 16 bits in the register buffer and a transfer of the data to the timer register. In this case, if the higher 8 bits (H1) are written after the interrupt routine is completed, only the flag for the higher 8 bits will be set, the flag for the lower 8 bits having been cleared in the interrupt routine. Therefore, even if a match occurs between UC0 and TB0RG1, no data transfer will be performed. Then, in an attempt to set the next set of data (H2L2) in the register buffer, when the lower 8 bits (L2) are written, this will cause the flag for the lower 8 bits to be set as well as the flag for the higher 8 bits which has been set by writing the previous data (H1). If a match between UC0 and TB0RG1 occurs before the higher 8 bits (H2) are written, this will cause unexpected data (H1L2) to be sent to the timer register instead of the intended data (H2L2). To avoid such transfer timing problems due to interrupts, the DI instruction (disable interrupts) and the EI (enable interrupts) can be executed before and after setting data in the register buffer, respectively. After a reset, TB0RG0H/L and TB0RG1H/L are undefined. If the 16-bit timer is to be used after a reset, data should be written to it beforehand. On a reset is initialized to "0", disabling the double buffer. To use the double buffer, write data to the timer register, set to "1", then write data to the register buffer 10 as shown below. TB0RG0H/L and the register buffer 0 both have the same memory addresses (0188H and 0189H) allocated to them. If = "0", the value is written to both the timer register and the register buffer 0. If = "1", the value is written to the register buffer 0 only. The addresses of the timer registers are as follows:
TMRB0
TB0RG0H/L Upper 8 bits 000189H Lower 8 bits 000188H
TB0RG1H/L Upper 8 bits 00018BH Lower 8 bits 00018AH
TMRB1
TB1RG0H/L Upper 8 bits 000199H Lower 8 bits 000198H
TB1RG1H/L Upper 8 bits 00019BH Lower 8 bits 00019AH
TMRB2
TB2RG0H/L Upper 8 bits 0001A9H Lower 8 bits 0001A8H
TB2RG1H/L Upper 8 bits 0001ABH Lower 8 bits 0001AAH
TMRB3
TB3RG0H/L Upper 8 bits 0001B9H Lower 8 bits 0001B8H
TB3RG1H/L Upper 8 bits 0001BBH Lower 8 bits 0001BAH
Note:The timer registers are write-only registers and thus cannot be read.
Page 106
2007-10-10
TMP91FU62
6.2.4
Capture registers (TB0CP0H/L, TB0CP1H/L)
These 16-bit registers are used to latch the values in the up counter (UC0). Data in the capture registers should be read all 16 bits. For example, using a 2-byte data load instruction or two 1-byte data load instructions. The least significant byte is read first, followed by the most significant byte. (during capture is read, capture operation is prohibited. In that case, the lower 8 bits should be read first, followed by the 8 bits.) The addresses of the capture registers are as follows;
TMRB0
TB0CP0H/L
Upper 8 bits 00018DH Lower 8 bits 00018CH
TB0CP1H/L
Upper 8 bits 00018FH Lower 8 bits 00018EH
TMRB1
TB1CP0H/L
Upper 8 bits 00019DH Lower 8 bits 00019CH
TB1CP1H/L
Upper 8 bits 00019FH Lower 8 bits 00019EH
TMRB2
TB2CP0H/L
Upper 8 bits 0001ADH Lower 8 bits 0001ACH
TB2CP1H/L
Upper 8 bits 0001AFH Lower 8 bits 0001AEH
TMRB3
TB3CP0H/L
Upper 8 bits 0001BDH Lower 8 bits 0001BCH
TB3CP1H/L
Upper 8 bits 0001BFH Lower 8 bits 0001BEH
Note:The capture registers are read-only registers and thus cannot be written to.
6.2.5
Capture Input Control and External Interrupt Control
This circuit controls the timing to latch the value of up-counter UC0 into TB0CP0H/L and TB0CP1H/L, and generates external interrupt.The latch timing of capture register and selection of edge for external interrupt is controlled by TB0MOD. The value in the up-counter (UC0) can be loaded into a capture register by software. Whenever 0 is written to TB0MOD, the current value in the up counter (UC0) is loaded into capture register TB0CP0H/ L. It is necessary to keep the prescaler in RUN mode (e.g., TB0RUN must be held at a value of 1).
Page 107
2007-10-10
TMP91FU62
6.2.6
Comparators (CP00, CP01)
CP10 and CP11 are 16-bit comparators which compare the value in the up counter UC0 with the value set in TB0RG0H/L or TB0RG1H/L respectively, in order to detect a match. If a match is detected, the comparator generates an interrupt (INTTB00 or INTTB01 respectively).
6.2.7
Timer flip-flops (TB0FF0, TB0FF1)
These flip-flops are inverted by the match detect signals from the comparators and the latch signals to the capture registers. Inversion can be enabled and disabled for each element using TB0FFCR. After a reset the value of TB0FF0 is undefined. If "00" is written to TB0FFCR or , TB0FF0 will be inverted. If "01" is written to the capture registers, the value of TB0FF0 will be set to "1". If "10" is written to the capture registers, the value of TB0FF0 will be set to "0".
Note:If an inversion by the match-detect signal and a setting change via the TB0FFCR register occurs simultaneously, the resultant operation varies depending on the situation, as shown below. * If an inversion by the match-detect signal and an inversion via the register occur simultaneously, the flip-flop will be inverted only once. * If an inversion by the match-detect signal and an attempt to set the flip-flop to 1 via the register occur simultaneously, the flip-flop will be set to 1. * If an inversion by the match-detect signal and an attempt to clear the flip-flop to 0 via the register occur simultaneously, the flip-flop will be cleared to 0. If an inversion by match-detect signal and inversion disable setting occur simultaneously, two case (it is inverted and it is not inverted) are occurred. Therefore, if changing inversion control (inversion enable/disable), stop timer operation beforehand.
The values of TB0FF0 and TB0FF1 can be output via the timer output pins TB0OUT0 (which is shared with P82 and TB0OUT1 (which is shared with P83). Timer output should be specified using the port P function register.
Page 108
2007-10-10
TMP91FU62
6.3 SFR
TMRB Run Register
7 Bit symbol TB0RUN (0180H) Read/Write After reset TB0RDE R/W 0 Double Buffer 0: Disable 1: Enable TB1RDE R/W 0 Double Buffer 0: Disable 1: Enable TB2RDE R/W 0 Double Buffer 0: Disable 1: Enable TB3RDE R/W 0 Double Buffer 0: Disable 1: Enable 6 - R/W 0 5 - - 4 - - 3 I2TB0 R/W 0 IDLE2 0: Stop 1: Operate - - I2TB1 R/W 0 IDLE2 0: Stop 1: Operate - - I2TB2 R/W 0 IDLE2 0: Stop 1: Operate - - I2TB3 R/W 0 IDLE2 0: Stop 1: Operate 2 TB0PRUN R/W 0 TMRB0 prescaler 0: Stop and Clear 1: Run (count up) TB1PRUN R/W 0 TMRB1 prescaler 0: Stop and Clear 1: Run (count up) TB2PRUN R/W 0 TMRB2 prescaler 0: Stop and Clear 1: Run (count up) TB3PRUN R/W 0 TMRB3 prescaler 0: Stop and Clear 1: Run (count up) - - - UC3 TB3RUN R/W 0 - - - UC2 TB2RUN R/W 0 - - - UC1 TB1RUN R/W 0 1 - - - UC0 0 TB0RUN R/W 0
Function
Always write 0.
Not in use
Bit symbol TB1RUN (0190H) Read/Write After reset
- R/W 0
- -
Function
Always write 0.
Not in use
Bit symbol TB2RUN (01A0H) Read/Write After reset
- R/W 0
- -
Function
Always write 0.
Not in use
Bit symbol TB3RUN (01B0H) Read/Write After reset
- R/W 0
- -
Function
Always write 0.
Not in use
Operation
I2TB0, I2TB1, I2TB2, I2TB3: Operation of IDLE2 mode TB0PRUN, TB1PRUN, TB2PRUN, TB3PRUN: Operation of prescaler TB0RUN, TB1RUN, TB2RUN, TB3RUN: Operation of TMRB 0 1 Stop and Clear Count
Note: Bits 1, 4 and 5 of TB0RUN/TB1RUN/TB2RUN/TB3RUN are "1" when read.
Page 109
2007-10-10
TMP91FU62
TMRB Mode Register (Read-modify-write instructions are prohibited.) (1/2)
7 Bit symbol TB0MOD (0182H) Read/Write After reset 0 TB0CT1 R/W 0 6 TB0ET1 5 TB0CP0I W* 1 0 0 4 TB0CPM1 3 TB0CPM0 2 TB0CLE R/W 0 0 0 1 TB0CLK1 0 TB0CLK0
TB0FF1 inversion trigger 0: Trigger disable 1: Trigger enable Function Invert when UC0 is loaded into TB0CP1H/L Bit symbol TB1MOD (0192H) Read/Write After reset 0 TB1CT1 R/W 0 Invert when UC0 matches with TB0RG1H/L TB1ET1
Software capture control 0: Software capture 1: Undefined
Capture timing 00: Disable INT5 occurs at rising edge 01: TB0IN0 TB0IN1 INT5 occurs at rising edge 10: TB0IN0 TB0IN0 INT5 occurs at falling edge 11: TA1OUT TA1OUT INT5 occurs at rising edge
Up counter control 0: Clear disable 1: Clear enable
TMRB0 input clock select 00: TB0IN0 pin input 01: T1 10: T4 11: T16
TB1CP0I W* 1
TB1CPM1
TB1CPM0
TB1CLE R/W
TB1CLK1
TB1CLK0
0
0
0
0
0
TB1FF1 inversion trigger 0: Trigger disable 1: Trigger enable Function Invert when UC1 is loaded into TB1CP1H/L Bit symbol TB2MOD (01A2H) Read/Write After reset 0 TB2CT1 R/W 0 Invert when UC1 matches with TB1RG1H/L TB2ET1
Software capture control 0: Software capture 1: Undefined
Capture timing 00: Disable INT7 occurs at rising edge 01: TB1IN0 TB1IN1 INT7 occurs at rising edge 10: TB1IN0 TB1IN0 INT7 occurs at falling edge 11: TA1OUT TA1OUT INT7 occurs at rising edge
Up counter control 0: Clear disable 1: Clear enable
TMRB1 input clock select 00: TB1IN0 pin input 01: T1 10: T4 11: T16
TB2CP0I W* 1
TB2CPM1
TB2CPM0
TB2CLE R/W
TB2CLK1
TB2CLK0
0
0
0
0
0
TB2FF1 inversion trigger 0: Trigger disable 1: Trigger enable Function Invert when UC2 is loaded into TB2CP1H/L Bit symbol TB3MOD (01B2H) Read/Write After reset 0 TB3CT1 R/W 0 Invert when UC2 matches with TB2RG1H/L TB3ET1
Software capture control 0: Software capture 1: Undefined
Capture timing 00: Disable INT1 occurs at rising edge 01: TB2IN0 TB2IN1 INT1 occurs at rising edge 10: TB2IN0 TB2IN0 INT1 occurs at falling edge 11: TA1OUT TA1OUT INT1 occurs at rising edge
Up counter control 0: Clear disable 1: Clear enable
TMRB2 input clock select 00: TB2IN0 pin input 01: T1 10: T4 11: T16
TB3CP0I W* 1
TB3CPM1
TB3CPM0
TB3CLE R/W
TB3CLK1
TB3CLK0
0
0
0
0
0
TB3FF1 inversion trigger 0: Trigger disable 1: Trigger enable Function Invert when UC3 is loaded into TB3CP1H/L Invert when UC3 matches with TB3RG1H/L
Software capture control 0: Software capture 1: Undefined
Capture timing 00: Disable INT3 occurs at rising edge 01: TB3IN0| TB3IN1| INT3 occurs at rising edge 10: TB3IN0| TB3IN0O INT3 occurs at falling edge 11: Don't care
Up counter control 0: Clear disable 1: Clear enable
TMRB3 input clock select 00: TB3IN0 pin input 01: T1 10: T4 11: T16
Page 110
2007-10-10
TMP91FU62
TMRB source clock
00 01 10 11 External input clock (TBnIN0 pin input) T1 T4 T16
Up counter clear control (UCn)
0 1 Clear by match with TBnRG1H/L Disable to clear up counter
Capture/Interrupt timing
Capture control 00 01 Disable capture Capture to TBnCP0H/L at rising edge of TBnIN0 Capture to TBnCP1H/L at rising edge of TBnIN1 Capture to TBnCP0H/L at rising edge of TBnIN0 Capture to TBnCP1H/L at falling edge of TBnIN0 Capture to TBnCP0H/L at rising edge of TA1OUT Capture to TBnCP1H/L at falling edge of TA1OUT TMRB3: Don't care INT generate at rising edge of TBnIN0 INT generate at falling edge of TBnIN0 INT generate at rising edge of TBnIN0 INT5 control
10
11
Software capture
0 1 Undefined (Note 2) Capture value of up counter to TBnCP0H/L.
Note 1: n=0,1,2,3 Note 2: As described above, whenever 0 is written to TBnMOD, the current value in the up counter is loaded into capture register TBnCP0H/L. However, note that the current value in the up counter is also loaded into capture register TBnCP0H/L when 1 is written to TBnMOD while this bit is holding 0.
Page 111
2007-10-10
TMP91FU62
TMRB Flip-Flop Control Register (Read-modify-write instructions are prohibited.) (1/2)
7 Bit symbol TB0FFCR (0183H) Read/Write After reset 1 TB0FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. Bit symbol TB1FFCR (0193H) Read/Write After reset 1 TB1FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. Bit symbol TB2FFCR (01A3H) Read/Write After reset 1 TB2FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. Bit symbol TB3FFCR (01B3H) Read/Write After reset 1 TB3FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. TB3FF1C1 W* 1 0 0 TB3FF1C0 TB2FF1C1 W* 1 0 0 TB2FF1C0 TB1FF1C1 W* 1 0 0 TB1FF1C0 TB0FF1C1 W* 1 0 0 6 TB0FF1C0 5 TB0C1T1 4 TB0C0T1 R/W 0 0 1 TB0FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. TB1FF0C1 W* 0 0 1 TB1FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. TB2FF0C1 W* 0 0 1 TB2FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. TB3FF0C1 W* 0 0 1 TB3FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11. 1 TB3FF0C0 1 TB2FF0C0 1 TB1FF0C0 3 TB0E1T1 2 TB0E0T1 1 TB0FF0C1 W* 1 0 TB0FF0C0
TB0FF0 inversion trigger 0: Disable 1: Enable Invert when UC0 is loaded into TB0CP1H/L. TB1C1T1 Invert when UC0 is loaded into TB0CP0H/L. TB1C0T1 R/W Invert when UC0 matches TB0RG1H/L. TB1E1T1 Invert when UC0 matches TB0RG0H/L. TB1E0T1
Function
TB1FF0 inversion trigger 0: Disable 1: Enable Invert when UC1 is loaded into TB1CP1H/L. TB2C1T1 Invert when UC1 is loaded into TB1CP0H/L. TB2C0T1 R/W Invert when UC1 matches TB1RG1H/L. TB2E1T1 Invert when UC1 matches TB1RG0H/L. TB2E0T1
Function
TB2FF0 inversion trigger 0: Disable 1: Enable Invert when UC2 is loaded into TB2CP1H/L. TB3C1T1 Invert when UC2 is loaded into TB2CP0H/L. TB3C0T1 R/W Invert when UC2 matches TB2RG1H/L. TB3E1T1 Invert when UC2 matches TB2RG0H/L. TB3E0T1
Function
TB3FF0 inversion trigger 0: Disable 1: Enable Invert when UC3 is loaded into TB3CP1H/L. Invert when UC3 is loaded into TB3CP0H/L. Invert when UC3 matches TB3RG1H/L. Invert when UC3 matches TB3RG0H/L.
Function
Page 112
2007-10-10
TMP91FU62
Timer flip-flop (TBnFF0) control
00 01 10 11 Clear TBnFF0 to 0. Don't care Invert TBnFF0. Set TBnFF0 to 1.
TBnFF0 inversion when UCn matches TBnRG0H/L
0 1 Enable trigger (enable inversion). Disable trigger (disable inversion).
TBnFF0 inversion when UCn matches TBnRG1H/L
0 1 Enable trigger (enable inversion). Disable trigger (disable inversion).
TBnFF0 inversion when UCn is loaded into TBnCP0H/L
0 1 Enable trigger (enable inversion). Disable trigger (disable inversion).
TBnFF0 inversion when UCn is loaded into TBnCP1H/L
0 1 Enable trigger (enable inversion). Disable trigger (disable inversion).
Timer flip-flop (TBnFF1) control
00 01 10 11 Clear TBnFF1 to 0. Don't care Invert TBnFF1. Set TBnFF1 to 1.
Note: n=0,1,2,3
Page 113
2007-10-10
TMP91FU62
6.4 Operation in Each Mode
6.4.1 16-Bit Interval Timer Mode
Generating interrupts at fixed intervals In this example the interrupt INTTB01 is set to be generated at fixed intervals. The interval time is set in the timer register TB0RG1H/L.
7 TB0RUN INTETB0 TB0FFCR TB0MOD 0 X 1 0
6 0 1 1 0
5 X 0 0 1
4 X 0 0 0
3 - X 0 0
2 0 0 0 1
1 X 0 1 *
0 0 0 1 * Select internal clock for input and disable the capture function. Stop TMRB0. Enable INTTB01 and set it to interrupt level 4. Disable INTTB00. Disable trigger.
(**=01, 10, 11) TB0RG1 * * TB0RUN 0 * * 0 * * X * * X * * - * * 1 * * X * * 1 Start TMRB0. Set interval time (16 bits).
Note:X: Don't care, -: No change
6.4.2
16-Bit Event Counter Mode
If the external clock (TB0IN0 pin input) is selected as the input clock in 16-bit timer mode, the timer can be used as an event counter. The up-counter counts up on the rising edge of TB0IN0 input. To read the value of the counter, first perform software capture once, then read the captured value.
6 TB0RUN P8CR P8FC INTETB0 TB0FFCR TB0MOD TB0RG1 0 - - X 1 0 * * TB0RUN 0 0 - - 1 1 0 * * 0
5 X - - 0 0 1 * * X
4 X - - 0 0 0 * * X
3 - - - X 0 0 * * -
2 0 - - 0 0 1 * * 1
1 X - - 0 1 0 * * X
0 0 0 1 0 1 0 * * 1 Start TMRB0. Stop TMRB0. Set port to input mode. Set port to input mode. Enable INTTB01 and set interrupt level 4. Disable INTTB00. Disable trigger. Select TB0IN0 as the input clock. Set the number of counts (16 bits).
Note 1: X: Don't care, -: No change Note 2: When the timer is used as an event counter, set the prescaler to run mode (TB0RUN = 1).
Page 114
2007-10-10
TMP91FU62
6.4.3
16-Bit Programmable Pulse Generation (PPG) Output Mode
Square wave pulses can be generated at any frequency and duty ratio. The output pulse may be either activeLow or active-High. In PPG mode a match between the value of the up-counter UC0 and either timer register TB0RG0 or TB0RG1 inverts the output value for timer flip-flop TB0FF0. The TB0FF0 output value is output on TB0OUT0. In this mode the following conditions must be satisfied. (value set in TB0RG0) < (value set in TB0RG1)
Match with TB0RG0 (INTTB00 interrupt) Match with TB0RG1 (INTTB01 interrupt) TB0OUT0 pin
Figure 6-2
Programmable Pulse Generation (PPG) Output Waveforms
When the TB0RG0 double buffer is enabled in this mode, the value of register buffer 0 will be shifted into TB0RG0 when the up-counter value matches TB0RG1. This feature facilitates the handling of low-duty waves.
Match with TB0RG0
Up-counter = Q1 Up-counter = Q2
Match with TB0RG1 Shift into TB0RG1 TB0RG0 (value to be compared) Register buffer Q1 Q2 Q2 Q3
Write to TB0RG0
Figure 6-3 Operation of Register Buffer
Note:The values that can be set in TBxRGx range from 0001h to 0000h (equivalent to 10000h). If the maximum value 0000h is set, the match-detect signal goes active when the up-counter overflows.
Page 115
2007-10-10
TMP91FU62
The following block diagram illustrates this mode.
TB0OUT0 (PPG TB0RUN )
Selector
TB0IN0 T1 T4 T16
16-bit up counter (UC0)
F/F (TB0FF0)
Clear
Match 16 16
Selector TB0RG0-WR
TB0RG0H/L
0 TB0RUN
TB0RG1H/L
Internal data bus
Figure 6-4
Block Diagram of 16-Bit PPG Mode
The following example shows how to set 16-bit PPG output mode:
7 TB0RUN TB0RG0 0 * * TB0RG1 * * TB0RUN 1
6 0 * * * * 0
5 X * * * * X
4 X * * * * X
3 - * * * * -
2 0 * * * * 0
1 X * * * * X
0 0 * * * * 0 Disable the TB0RGH/L double buffer and stop TMRB0. Set the duty ratio. (16 bits) Set the frequency. (16 bits) Enable the TB0RG0H/L double buffer. (The duty and frequency are changed on an INTTB01 interrupt.) Set the mode to invert TB0FF0 at the match with TB0RG0H/L, TB0RG1H/L. Clear TB0FF0 to "0". Select prescaler output as input clock and disable the capture function. Set P82 to function as TB0OUT0.
TB0FFCR TB0MOD
1 0
1 0
0 1
0 0
1 0
1 1
1 *
0 *
(**=01, 10, 11) P8CR P8FC TB0RUN - - 1 - - 0 - - X - - X - - - 1 1 1 - - X - - 1
Start TMRB0.
Note:X: Don't care, -: No change
Page 116
2007-10-10
TMP91FU62
6.4.4
Capture function examples
Used capture function, they can be applicable in many ways, for example: 1. One-shot pulse output from external trigger pulse 2. Frequency measurement 3. Pulse width measurement 4. Time difference measurement
6.4.4.1
One-shot pulse output from external trigger pulse
Set the up counter UC0 in free-running mode with the internal input clock, input the external trigger pulse from TB0IN0 pin, and load the value of up-counter into capture register TB0CP0H/L at the rise edge of the TB0IN0 pin. When the interrupt INT5 is generated at the rise edge of TB0IN0 input, set the TB0CP0H/L value (c) plus a delay time (d) to TB0RG0H/L (= c + d), and set the above set value (c + d) plus a one-shot width (p) to TB0RG1H/L (= c + d + p). And, set "11" to timer flip-flop control register TB0FFCR. Set to trigger enable for be inverted timer flip-flop TB0FF0 by UC0 matching with TB0RG0H/L and with TB0RG1H/L. When interrupt INTTB01 occurs, this inversion will be disabled after one-shot pulse is output. The (c), (d) and (p) correspond to c, d and p Figure 6-5.
Set the counter in free-running mode.
Count clock (Prescaler output clock)
c c+d c+d+p
TB0IN0 pin input (External trigger pulse) Match with TB0RG0H/L
Load to capture register 0 (TB0CP0H/L) INT5 occurred
Match with TB0RG1H/L Timer output pin TB0OUT0
Disables inversion caused by loading into TB0CP1H/L.
Inversion enable Inversion enable
INTTB01 occurred
Delay time d
Pulse width p
Figure 6-5 One-shot Pulse Output (with delay)
Page 117
2007-10-10
TMP91FU62
Example: To output a 2-ms one-shot pulse with a 3-ms delay to the external trigger pulse to the TB0IN0 pin.
* Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) fFPH
TB0MOD TB0FFCR P8CR P8FC INTE56 INTETB0 TB0RUN

X X - - X X -
X X - - - 0 0
1 0 - - - 0 X
0 0 - - - 0 X
1 0 - - X X -
0 0 1 1 1 0 1
0 1 - - 0 0 X
1 0 - - 0 0 1
Set free running. Count with T1. Load the up counter value into TB0CP0H/L at the rising edge of TB0IN0 pin input. Clear TB0FF0 to 0. Disable inversion of TB0FF0. Set P82 to function as the TB0OUT0 pin. Set P80 to TB0IN0 input mode. Enable INT5. Disable INTTB00 and INTTB01. Start TMRB0.
TB0RG0 TB0RG1 TB0FFCR INTETB0

TB0CP0 + 3 ms/T1 TB0RG0 + 2 ms/T1 X X X 1 - 0 - 0 1 X 1 - - - - - Enable TB0FF0 inversion when the up counter value match with TB0RG0H/L or TB0RG1H/L. Enable INTTB01.
TB0FFCR INTETB0

X X
X 0
- 0
- 0
0 X
0 -
- -
- -
Disable inversion of TB0FF0 when the up counter value match with value of TB0RG0H/L or TB0RG1H/L. Disable INTTB01.
Note: X: Don't care, -: No change
When delay time is unnecessary, invert timer flip-flop TB0FF0 when up-counter value is loaded into capture register (TB0CP0H/L), and set the TB0CP0H/L value (c) plus the one-shot pulse width (p) to TB0RG1H/L when the interrupt INT5 occurs. The TB0FF0 inversion should be enable when the up counter (UC10) value matches TB0RG1H/L, and disabled when generating the interrupt INTTB01.
Count clock (Prescaler output clock)
c c+p Load into capture register 0 (TB0CP0H/L). INT5 occurred. INTTB01 occurred. Load the up counter value in capture register 1 (TB0CP1
TB0IN0 pin input (External trigger pulse) Match with TB0RG1H/L
Inversion enable
Timer output TB0OUT0
Enables inversion caused by loading into TB0CP0H/L.
Pulse width p Disable inversion caused by loading into TB0CP1H/L.
Figure 6-6
One-shot Pulse Output (without delay)
Page 118
2007-10-10
TMP91FU62
6.4.4.2
Frequency measurement
The frequency of the external clock can be measured in this mode. The clock is input through the TB0IN0 pin, and its frequency is measured by the 8-bit timers TMRA01 and the 16-bit timer/event counter (TMRB0). (TMRA01 is used to setting of measurement time by inversion TA1FF.) The TB0IN0 pin input should be for the input clock of TMRB0. Set to TB0MOD = "11". The value of the up counter (UC10) is loaded into the capture register TB0CP0H/L at the rise edge of the timer flip-flop TA1FF of 8-bit timers (TMRA01), and into TB0CP1H/L at its fall edge. The frequency is calculated by difference between the loaded values in TB0CP0H/L and TB0CP1H/L when the interrupt (INTTA0 or INTTA1) is generates by either 8-bit timer.
Count clock (TB0IN0 pin input)
C1 C2
TA1FF
Load to TB0CP0H/L
C1
C1
Load to TB0CP1H/L
C2
C2
INTTA0/INTTA1
Figure 6-7 Frequency Measurement
For example, if the value for the level 1 width of TA1FF of the 8-bit timer is set to 0.5 s and the difference between the values in TB0CP0H/L and TB0CP1H/L is 100, the frequency is 100 / 0.5 s = 200 Hz.
Note: The frequency in this example is calculated with 50 duty.
Page 119
2007-10-10
TMP91FU62
6.4.4.3
Pulse width measurement
This mode allows to measure the high-level width of an external pulse. While keeping the 16-bit timer/ event counter counting (Free running) with the internal clock input, external pulse is input through the TB0IN0 pin. Then the capture function is used to load the UC0 values into TB0CP0H/L and TB0CP1H/L at the rising edge and falling edge of the external trigger pulse respectively. The interrupt INT5 occurs at the falling edge of TB0IN0. The pulse width is obtained from the difference between the values of TB0CP0H/L and TB0CP1H/L and the internal clock cycle. For example, if the internal clock is 0.8 s and the difference between TB0CP0H/L and TB0CP1H/L is 100, the pulse width will be 100 x 0.8 s = 80 s. Additionally, the pulse width which is over the UC0 maximum count time specified by the clock source, can be measured by changing software.
Count clock (Prescaler output clock)
C1 C2
TB0IN0 pin input (External pulse) Load to TB0CP0H/L
C1 C1
Load to TB0CP1H/L
C2
C2
INT5
Figure 6-8 Pulse Width Measurement
Note: Only in this pulse width measuring mode (TB0MOD = 10), external interrupt INT5 occurs at the falling edge of TB0IN0 pin input. In other modes, it occurs at the rising edge.
The width of low-level can be measured from the difference between the first C2 and the second C1 at the second INT5 interrupt.
Page 120
2007-10-10
TMP91FU62
6.4.4.4
Time Difference Measurement
This mode is used to measure the difference in time between the rising edges of external pulses input through TB0IN0 and TB0IN1. Keep the 16-bit timer/event counter (TMRB0) counting (Free running) with the internal clock, and load the UC0 value into TB0CP0H/L at the rising edge of the input pulse to TB0IN0. Then the interrupt INT5 is generated. Similarly, the UC0 value is loaded into TB0CP1H/L at the rising edge of the input pulse to TB0IN1, generating the interrupt INT6. The time difference between these pulses can be obtained by multiplying the value subtracted TB0CP0H/L from TB0CP1H/L and the internal clock cycle together at which loading the up counter value into TB0CP0H/L and TB0CP1H/L has been done.
Count clock (Prescaler output clock)
C1 C2
TB0IN0 pin input
TB0IN1 pin input
Load to TB0CP0H/L Load to TB0CP1H/L
INT5
INT6
Time difference
Figure 6-9 Time Difference Measurement
Page 121
2007-10-10
TMP91FU62
7. Serial Channels (SIO)
TMP91FU62 includes 3 serial I/O channels. For both channels either UART mode (Asynchronous transmission) or I/O interface mode (Synchronous transmission) can be selected. 1. I/O interface mode * Mode 0: For transmitting and receiving I/O data using the synchronizing signal SCLK for extending I/O. 2. UART mode * Mode 1: 7-bit data * Mode 1: 8-bit data * Mode 1: 9-bit data In mode 1 and mode 2, a parity bit can be added. Mode 3 has a wakeup function for the master controller to start slave controllers via a serial link (A multi-controller system). Figure 7-2 are block diagrams for each channel. SIO is compounded mainly prescaler, serial clock generation circuit, receiving buffer and control circuit, transmission buffer and control circuit. Both channels operate in the same function except for the following points; hence only the operation of channel 0 is explained below. Table 7-1 Differences in Serial Channel Specifications
SIO0 TXD0, RXD0 (P90) RXD0, TXD0 (P91) CTS0/SCLK0 (P92) SIO1 TXD1, RXD1 (P93) RXD1, TXD1 (P94) CTS1/SCLK1 (P95) SIO2 TXD2, RXD2 (P41) RXD2, TXD2 (P42) CTS2/SCLK2 (P43)
Pin name
Mode 0 (I/O interface mode Bit 0 1 2 3 4 5 6 7
Transfer direction Mode 1 (7-bit UART mode)
No parity
Start
Bit 0
1
2
3
4
5
6
Stop
Parity
Start
Bit 0
1
2
3
4
5
6
Parity Stop
Mode 2 (8-bit UART mode)
No parity
Start
Bit 0
1
2
3
4
5
6
7
Stop
Parity
Start
Bit 0
1
2
3
4
5
6
7
Parity Stop
Mode 3 (9-bit UART mode Start Bit 0 1 2 3 4 5 6 7 8 Stop
Wakeup function
Start
Bit 0
1
2
3
4
5
6
7
Bit 8
Stop
When bit8 = 1, address (Select code) is denoted. When bit8 = 0, data is denoted.
Figure 7-1 Data Formats
Page 122
2007-10-10
TMP91FU62
7.1 Block Diagrams
Prescaler 4 8 16 32 64 T2
BRnCR BRnCR
T0
2
T8
T32
Serial clock generation circuit
TA0TRG (from TMRA0) BRnADD
Prescaler
Selector
Selector
T0 T2 T8 T32
Selector
UART mode
SIOCLK
BRnCR Baud date generator
SCnMOD0
SCnMOD0
fSYS 2
SCLKn
Selector
I/O interface mode
I/O interface mode SCLKn
SC0CR INT request INTRXn INTTXn
Receive counter (UART only 16) RXDCLK SCnMOD0 Receive control
SCnMOD0
Serial channel interrupt control
Transmission counter (UART only 16)
TXDCLK
Transmission SCnCR control SCnMOD0 CTSn
RXDn
Receive buffer 1 (Shift register)
Parity control
RB8
Receive buffer 2 (SCnBUF)
Error flag
TB8
Transmission buffer (SCnBUF)
TXDn
SCnCR
Internal data bus
Figure 7-2 Block Diagram of the Serial Channel 0/1/2
Page 123
2007-10-10
TMP91FU62
7.2 Operation of Each Circuit
7.2.1 Prescaler
A 6-bit prescaler generates an operation clock for SIO0. The prescaler is acteve only when a baud rate generator is specified as a serial transfer clock. As an input clock of the prescaler, be sure to set SYSCR0 to "0" and then specify fFPH. This clock is used for T0 with being divided by 4. Table 7-2 shows prescaler clock resolution into the baud rate generator. Table 7-2 Prescaler Clock Resolution to Baud Rate Generator
Gear Value XXX 000 (fc) 001 (fc/2) 0 (fc) 010 (fc/4) 011 (fc/8) 100 (fc/16) 0 (1/1) fFPH Select Prescaler Clock Prescaler Output Clock Resolution T0 22/fs 22/fc 23/fc 24/fc 25/fc 26/fc T2 24/fs 24/fc 25/fc 26/fc 27/fc 28/fc T8 26/fs 26/fc 27/fc 28/fc 29/fc 210/fc T32 28/fs 28/fc 29/fc 210/fc 211/fc 212/fc
Select System Clock 1 (fs)
The baud rate generator selects between 4 clock inputs: T0, T2, T8, and T32 among the prescaler outputs.
7.2.2
Baud rate generator
The baud rate generator is a circuit which generates transmission and receiving clocks which determine the transmission rate of the serial channels. The input clock to the baud rate generator, T0, T2, T8 or T32, is generated by the 6-bit prescaler which is shared by the timers. One of these input clocks is selected using the BR0CR field in the baud rate generator control register. The baud rate generator includes a frequency divider, which divides the frequency by 1, N + (16 - K)/16 or 16 values, determining the transmission rate. The transmission rate is determined by the settings of BR0CR and BR0ADD.
Page 124
2007-10-10
TMP91FU62
7.2.2.1
In UART mode
(1) When BR0CR = 0 The settings BR0ADD are ignored. The baud rate generator divides the selected prescaler clock by N, which is set in BR0CK. (N = 1, 2, 3 ... 16)
(2)
When BR0CR = 1 The N + (16 - K)/16 division function is enabled. The baud rate generator divides the selected prescaler clock by N + (16 - K)/16 using the value of N set in BR0CR (N = 2, 3 ... 15) and the value of K set in BR0ADD (K = 1, 2, 3 ... 15)
Note: If N = 1 and N = 16, the N + (16 - K)/16 division function is disabled. Set BR0CR to "0".
7.2.2.2
In I/O interface mode
The N + (16 - K)/16 division function is not available in I/O interface mode. Set BR0CR to "0" before dividing by N. The method for calculating the transmission rate when the baud rate generator is used is explained below.
(1)
In UART mode Input clock of baud rate generator Baud rate = --------------------------------------------------------------------------------------------------- / 16 Frequency divider for baud rate generator
(2)
In I/O interface mode Input clock of baud rate generator Baud rate = --------------------------------------------------------------------------------------------------- / 2 Frequency divider for baud rate generator
7.2.2.3
Integer divider (N divider)
For example, when the source clock frequency (fc) =19.6608 MHz, the input clock frequency = T2 (fc/ 16), the frequency divider N (BR0CR) = 8, and BR0CR = 0, the baud rate in UART mode is as follows:
*Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) fFPH
fc 16 Baudrate = ------------- / 16 8 = 19.6608 x 106 / 16 / 8 / 16 = 9600 (bps)
Note: The + (16 - K)/16 division function is disabled and setting BR0ADD is invalid.
Page 125
2007-10-10
TMP91FU62
7.2.2.4 N + (16 - K)/16 divider (UART mode only)
Accordingly, when the source clock frequency (fc) = 15.9744 MHz, the input clock frequency = T2, the frequency divider N (BR0CR) = 6, K (BR0ADD) = 8, and BR0CR = 1, the baud rate in UART mode is as follows:
*Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) fFPH
fc/16 Baudrate= ---------------------------- / 16 ( 16 - 8 ) 6 + ------------------ 16 6 8 = 15.9744 x 10 / 16 / 6 + ----- / 16 = 9600(bps) 16
Table 7-3 show examples of UART mode transfer rates. Additionally, the external clock input is available in the serial clock. The method for calculating the baud rate is explained below: * In UART mode Baud rate = External clock input frequency / 16 It is necessary to satisfy (External clock input cycle) 4/fSYS * In I/O interface mode Baud rate = External clock input frequency It is necessary to satisfy (External clock input cycle) 16/fSYS Table 7-3 UART Baud Rate Selection
(When baud rate generator is used and BR0CR=0, SYSCR0=0)
Input Clock fc [MHz] Frequency Divider N 7.3728 9.8304 1 3 6 A C F 1 2 4 5 8 10 T0 (fc/4) 115.200 38.400 19.200 11.520 9.600 7.680 153.600 76.800 38.400 30.720 19.200 9.600 T2 (fc/16) 28.800 9.600 4.800 2.880 2.400 1.920 38.400 19.200 9.600 7.680 4.800 2.400 T8 (fc/64) 7.200 2.400 1.200 0.720 0.600 0.480 9.600 4.800 2.400 1.920 1.200 0.600 T32 (fc/256) 1.800 0.600 0.300 0.180 0.150 0.120 2.400 1.200 0.600 0.480 0.300 0.150
Unit (kbps)
Note: Transmission rates in I/O interface mode are eight times faster than the values given above.
Page 126
2007-10-10
TMP91FU62
Timer out clock (TA0TRG) can be used for source clock of UART mode only. Calculation method the frequency of TA0TRG Frequency of TA0TRG = Baud rate x 16
Note: In case of I/O interface mode, prohibit to use TA0TRG for source clock.
7.2.3
Serial clock generation circuit
This circuit generates the basic clock for transmission and receiving data.
7.2.3.1
In I/O interface mode
In SCLK output mode with the setting SC0CR = "0", the basic clock is generated by dividing the output of the baud rate generator by 2, as described previously. In SCLK input mode with the setting SC0CR = "1", the rising edge or falling edge will be detected according to the setting of the SC0CR register to generate the basic clock.
7.2.3.2
In UART mode
The SC0MOD0 setting determines whether the baud rate generator clock, the internal system clock fSYS, the match detect signal from timer TMRA0 or the external clock (SCLK0) is used to generate the basic clock SIOCLK.
7.2.4
Receiving counter
The receiving counter is a 4-bit binary counter used in UART mode which counts up the pulses of the SIOCLK clock. It takes 16 SIOCLK pulses to receive 1 bit of data; each data bit is sampled three times - on the 7th, 8th and 9th clock cycles. The value of the data bit is determined from these three samples using the majority rule. For example, if the data bit is sampled respectively as "1", "0" and "1" on 7th, 8th and 9th clock cycles, the received data bit is taken to be "1". A data bit sampled as "0", "0" and "1" is taken to be "0".
7.2.5
Receiving control
In I/O interface mode
In SCLK output mode with the setting SC0CR = "0", the RXD0 signal is sampled on the rising or falling edge of the shift clock which is output on the SCLK0 pin, according to the SC0CR setting. In SCLK input mode with the setting SC0CR = "1", the RXD0 signal is sampled on the rising or falling edge of the SCLK0 input, according to the SC0CR setting.
7.2.5.1
7.2.5.2
In UART mode
The receiving control block has a circuit which detects a start bit using the majority rule. Received bits are sampled three times; when two or more out of three samples are "0", the bit is recognized as the start bit and the receiving operation commences. The values of the data bits that are received are also determined using the majority rule. Page 127
2007-10-10
TMP91FU62 7.2.6 Receiving buffers
To prevent overrun errors, the receiving buffers are arranged in a double-buffer structure. Received data is stored one bit at a time in receiving buffer 1 (which is a shift register). When 7 or 8 bits of data have been stored in receiving buffer 1, the stored data is transmitted to receiving buffer 2 (SC0BUF); this causes an INTRX0 interrupt to be generated. The CPU only reads receiving buffer 2 (SC0BUF). Even before the CPU reads receiving buffer 2 (SC0BUF), the received data can be stored in receiving buffer 1. However, unless receiving buffer 2 (SC0BUF) is read before all bits of the next data are received by receiving buffer 1, an overrun error occurs. If an overrun error occurs, the contents of receiving buffer 1 will be lost, although the contents of receiving buffer 2 and SC0CR will be preserved. SC0CR is used to store either the parity bit - added in 8-bit UART mode - or the most significant bit (MSB) - in 9-bit UART mode. In 9-bit UART mode the wakeup function for the slave controller is enabled by setting SC0MOD0 to "1"; in this mode INTRX0 interrupts occur only when the value of SC0CR is "1".
Note 1: The double buffer structure does not support SC0CR. Note 2: If the CPU reads receive buffer 2 while data is being transferred from receive buffer 1 to receive buffer 2, the data may not be read properly. To avoid this situation, a read of receive buffer 2 should be triggered by a receive interrupt.
7.2.7
Transmission counter
The transmission counter is a 4-bit binary counter which is used in UART mode and which, like the receiving counter, counts the SIOCLK clock pulses; a TXDCLK pulse is generated every 16 SIOCLK clock pulses.
SIOCLK
15
TXDCLK
16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1
2
Figure 7-3 Generation of the Transmission Clock
7.2.8
Transmission controller
In I/O interface mode
In SCLK output mode with the setting SC0CR = "0", the data in the transmission buffer is output one bit at a time to the TXD0 pin on the rising or falling edge of the shift clock which is output on the SCLK0 pin, according to the SC0CR setting. In SCLK input mode with the setting SC0CR = "1", the data in the transmission buffer is output one bit at a time on the TXD0 pin on the rising or falling edge of the SCLK0 input, according to the SC0CR setting.
7.2.8.1
7.2.8.2
In UART mode
When transmission data sent from the CPU is written to the transmission buffer, transmission starts on the rising edge of the next TXDCLK.
Page 128
2007-10-10
TMP91FU62
7.2.8.3
Handshake function
Use of CTS0 pin allows data can be sent in units of one frame; thus, overrun errors can be avoided. The handshake function is enabled or disabled by the SC0MOD0 setting. When the CTS0 pin goes high on completion of the current data send, data transmission is halted until the CTS0 pin goes low again. However, the INTTX0 interrupt is generated, it requests the next data send to the CPU. The next data is written in the transmission buffer and data transmission is halted. Though there is no RTS pin, a handshake function can be easily configured by setting any port assigned to be the RTS function. The RTS should be output "high" to request send data halt after data receive is completed by software in the RXD interrupt routine.
TXD CTS0
RXD RTS (Any port)
Sender
Receiver
Figure 7-4 Handshake Function
Timing to write to the transmission buffer
Transmission is suspended during this period b
CTS0
a
13 14 15 16 1
2
3
13 14 15 16 1
2
3
SIOCLK
TXDCLK Start bit
TXD
Bit 0
Note 1: If the CTS0 signal goes high during transmission, no more data will be sent after completion of the current transmission. Note 2: Transmission starts on the first falling edge of the TXDCLK clock after the CTS0 signal has fallen.
Figure 7-5 CTS0 (Clear to send) Timing
Page 129
2007-10-10
TMP91FU62
7.2.9
Transmission buffer
The transmission buffer (SC0BUF) shifts out and sends the transmission data written from the CPU from the least significant bit (LSB) in order. When all the bits are shifted out, the transmission buffer becomes empty and generates an INTTX0 interrupt.
7.2.10 Parity control circuit
When SC0CR in the serial channel control register is set to "1", it is possible to transmit and receive data with parity. However, parity can be added only in 7-bit UART mode or 8-bit UART mode. The SC0CR field in the serial channel control register allows either even or odd parity to be selected. In the case of transmission, parity is automatically generated when data is written to the transmission buffer SC0BUF. The data is transmitted after the parity bit has been stored in SC0BUF in 7-bit UART mode or in SC0MOD0 in 8-bit UART mode. SC0CR and SC0CR must be set before the transmission data is written to the transmission buffer. In the case of receiving, data is shifted into receiving buffer 1, and the parity is added after the data has been transmitted to receiving buffer 2 (SC0BUF), and then compared with SC0BUF in 7-bit UART mode or with SC0CR in 8-bit UART mode. If they are not equal, a parity error is generated and the SC0CR flag is set.
7.2.11 Error flags
Three error flags are provided to increase the reliability of data reception.
7.2.11.1 Overrun error
If all the bits of the next data item have been received in receiving buffer 1 while valid data still remains stored in receiving buffer 2 (SC0BUF), an overrun error is generated. The below is a recommended flow when the overrun error is generated. (INTRX interrupt routine) 1. Read receiving buffer 2. Read error flag 3. if = 1 then a. Set to disable receiving (Write "0" to SC0MOD0) b. Wait to terminate current frame c. Read receiving buffer d. Read error flag e. Set to enable receiving (Write "1" to SC0MOD0) f. Request to transmit again 4. Other
Note: Overrun errors are generated only with regard to receive buffer 2 (SC0BUF). Thus, if SC0CR is not read, no overrun error will occur.
Page 130
2007-10-10
TMP91FU62
7.2.11.2 Parity error
The parity generated for the data shifted into receiving buffer 2 (SC0BUF) is compared with the parity bit received via the RXD pin. If they are not equal, a parity error is generated.
Note: The parity error flag is cleared every time it is read. However, if a parity error is detected twice in succession and the parity error flag is read between the two parity errors, it may seem as if the flag had not been cleared. To avoid this situation, a read of the parity error flag should be triggered by a receive interrupt.
7.2.11.3 Framing error
The stop bit for the received data is sampled three times around the center. If the majority of the samples are "0", a framing error is generated.
7.2.12 Timing generation
7.2.12.1 In UART mode
Table 7-4 Receiving
Mode Interrupt timing Framing error timing Parity error timing 9 Bits Center of last bit (Bit8) Center of stop bit - Center of last bit (Bit8) 8 Bits + Parity Center of last bit (Parity bit) Center of stop bit Center of last bit (Parity bit) Center of last bit (Parity bit) 8 Bits, 7 Bits + Parity, 7 Bits Center of stop bit Center of stop bit Center of stop bit
Overrun error timing
Center of stop bit
Note 1: In 9 Bits and 8 Bits + Parity mode, interrupts coincide with the ninth bit pulse. Thus, when servicing the interrupt, it is necessary to wait for a 1-bit period (to allow the stop bit to be transferred) to allow checking for a framing error. Note 2: The higher the transfer rate, the later than the middle receive interrupts and errors occur.
Table 7-5
Transmitting
Mode 9 Bits Just before stop bit is transmitted 8 Bits + Parity Just before stop bit is transmitted 8 Bits, 7 Bits + Parity, 7 Bits Just before stop bit is transmitted
Interrupt timing
7.2.12.2 I/O interface
Transmission interrupt timing
SCLK output mode
Immediately after the last bit. (See Figure 7-8) Immediately after rise of last SCLK signal rising mode, or immediately after fall in falling mode. (See Figure 7-9) Timing used to transmit received data to receive buffer 2 (SC0BUF) (e.g., immediately after last SCLK). (See Figure 7-10) Timing used to transmit received data to receive buffer 2 (SC0BUF) (e.g., immediately after last SCLK). (See Figure 7-11)
SCLK input mode
Receiving interrupt timing
SCLK output mode
SCLK input mode
Page 131
2007-10-10
TMP91FU62
7.3 SFR
Serial Control Register (Read-modify-write instructions are prohibited.)
7 SC0CR (0201H) Bit symbol Read/Write After reset SC1CR (0209H) Function SC2CR (0211H) Received data bit8 Parity 0: Odd 1: Even RB8 R Undefined 0 6 EVEN R/W 0 0 Overrun error flag 0: Undetect error 1: Detect error 5 PE 4 OERR 3 PERR 2 FERR 1 SCLKS R/W 0 Framing error flag 0: Undetect error 1: Detect error 0 Edge selection for SCLK pin (I/ O mode) 0: SCLK 1: SCLK 0 Edge selection for SCLK pin (I/ O mode) 0: SCLK 1: SCLK 0 IOC
R (Cleared to "0" when read) 0 Parity error flag 0: Undetect error 1: Detect error
Parity addition 0: Disable 1: Enable
Note1: As all error flags are cleared after reading, do not test only a single bit with a bit-testing instruction. Note2: A baud rate generator SCnCR = "0" is unavailable as an input clock for an I/O interface if a prescaler clock is set to fc/16 whenSYSCR0 is "1". Note3: n =0, 1, 2.
Serial Mode Control Register 0
7 Bit symbol SC0MOD0 (0202H) SC1MOD0 (020AH) SC2MOD0 (0212H) Function Read/Write After reset 0 0 0 0 TB8 6 CTSE 5 RXE 4 WU R/W 0 0 0 0 3 SM1 2 SM0 1 SC1 0 SC0
Transmission data bit8
Handshake function 0: Disable 1: Enable
Receive function 0: Disable 1: Enable
Wakeup function 0: Disable 1: Enable
Serial transmission mode 00: I/O interface mode 01: 7-bit UART mode 10: 8-bit UART mode 11: 9-bit UART mode
Serial transmission clock (UART) 00: Timer TA0TRG 01: Baud rate generator 10: Internal clock fSYS 11: External clock (SCLK input)
Note: SCLKpin and CTS pin
SCLK pin SIO0 SIO1 SIO2 SCLK0 SCLK1 SCLK2 CTS pin CTS0 CTS1 CTS2
Note2: A baud rate generator SCnMOD0 = "01" is unavailable as a serial transfer clock if a prescaler clock is set to fc/16 whenSYSCR0 is "1". Note3: n =0, 1, 2.
Serial Mode Control Register 1
7 Bit symbol Read/Write After reset SC0MOD1 (0205H) SC1MOD1 (020DH) SC2MOD1 (0215H) Bit symbol Read/Write After reset Bit symbol Read/Write After reset I2S0 R/W 0 I2S1 R/W 0 I2S2 R/W 0 IDLE2 0: Stop 1: Run 6 FDPX0 R/W 0 FDPX1 R/W 0 FDPX2 R/W 0 Duplex 0: Half 1: Full 5 - - - - - - - - - 4 - - - - - - - - - 3 - - - - - - - - - 2 - - - - - - - - - 1 - - - - - - - - - 0 - - - - - - - - -
Function
Page 132
2007-10-10
TMP91FU62
Baud Rate Generator Control
7 Bit symbol BR0CR (0203H) Read/Write After reset Bit symbol BR1CR (020BH) Read/Write After reset Bit symbol BR2CR (0213H) Read/Write After reset 0 0 0 0 0 - 0 BR2ADDE 0 BR2CK1 0 BR2CK0 R/W 0 0 0 0 0 - 0 BR1ADDE 0 BR1CK1 0 BR1CK0 R/W 0 BR2S3 0 BR2S2 0 BR2S1 0 BR2S0 - 6 BR0ADDE 5 BR0CK1 4 BR0CK0 R/W 0 BR1S3 0 BR1S2 0 BR1S1 0 BR1S0 3 BR0S3 2 BR0S2 1 BR0S1 0 BR0S0
Function
Always write "0".
+ (16 - K)/16 division 0: Disable 1: Enable
Input clock selection for baud rate generator 00: T0 01: T2 10: T8 11: T32
Setting of the divided frequency "N"
7 Bit symbol BR0ADD (0204H) Read/Write After reset Bit symbol BR1ADD (020CH) Read/Write After reset Bit symbol BR2ADD (0214H) Read/Write After reset Function - - - - - - - - -
6 - - - - - - - - -
5 - - - - - - - - -
4 - - - - - - - - -
3 BR0K3
2 BR0K2 R/W
1 BR0K1
0 BR0K0
0 BR1K3
0 BR1K2 R/W
0 BR1K1
0 BR1K0
0 BR2K3
0 BR2K2 R/W
0 BR2K1
0 BR2K0
0
0
0
0
Sets frequency divisor "K" (Divided by N + (16 - K)/16)
Baud rate generator frequency divisor setting
BRnCR = 1 BRnCR BRnADD 0000 0001 (K = 1) to 1111 (K = 15) Disable Disable Disable Divided by N + (16 - K)/ 16 Divided by N 0000(N=16) or 0001(N=1) 0010(N=2) to 1111(N=15) BRnCR = 0 0001(N=1)UART only to 1111(N=15) 0000(N=16)
Note: Availability of +(16 - K)/16 division function
N 2 to 15 1, 16 UART mode O x I/O mode x x The baud rate generator can be set "1" in UART mode and disable + (16 K)/16 division function. Don't use in I/O interface mode.
Note: Set BR1CR to 1 after setting K (K = 1 to 15) to BR1ADD when N+ (16 - K)/16 division function is used. Note: n = 0,1,2
Page 133
2007-10-10
TMP91FU62
Serial Transmission/receiving Buffer Registers (Read-modify-write instructions are prohibited.)
7 SC0BUF (0200H) SC1BUF (0208H) SC2BUF (0210H) TB7 6 TB6 5 TB5 4 TB4 3 TB3 2 TB2 1 TB1 0 TB0 (Transmission)
7 RB7
6 RB6
5 RB5
4 RB4
3 RB3
2 RB2
1 RB1
0 RB0 (Receiving)
7.4 Operation in Each Mode
7.4.1 Mode 0 (I/O interface mode)
This mode allows an increase in the number of I/O pins available for transmitting data to or receiving data from an external shift register. This mode includes the SCLK output mode to output synchronous clock SCLK and SCLK input mode to input external synchronous clock SCLK.
Output extension Shift register TXD SCLK Port SI SCK RCK A B C D E F G H TC74HC595 or equivalent Input extension Shift register RXD SCLK Port QH CLOCK S/L A B C D E F G H
TC74HC165 or equivalent
Figure 7-6 SCLK Output Mode Connection Example
Output extension Shift register TXD SCLK Port SI SCK RCK A B C D E F G H
Input extension Shift register RXD SCLK Port QH CLOCK S/L A B C D E F G H
TC74HC595 or equivalent External clock
TC74HC165 or equivalent External clock
Figure 7-7 SCLK Input Mode Connection Example
Page 134
2007-10-10
TMP91FU62
7.4.1.1
Transmission
In SCLK output mode 8-bit data and a synchronous clock are output on the TXD0 and SCLK0 pins respectively each time the CPU writes the data to the transmission buffer. When all data is output, INTES0 will be set to generate the INTTX0 interrupt.
Timing to write transmission data SCLK0 output ( = 0: Rising edge mode) SCLK0 output ( = 1: Falling edge mode) Bit 0 Bit 1 Bit 6 Bit 7 (Internal clock timing)
TXD0
ITX0C (INTTX0 interrupt request)
Figure 7-8 Transmitting Operation in I/O Interface Mode (SCLK output mode)
In SCLK input mode, 8-bit data is output on the TXD0 pin when the SCLK0 input becomes active after the data has been written to the transmission buffer by the CPU. When all data is output, INTES0 will be set to generate INTTX0 interrupt.
SCLK0 input ( = 0: Rising edge mode) SCLK0 input ( = 1: Falling edge mode) Bit 0 Bit 1 Bit 5 Bit 6 Bit 7
TXD0
ITX0C (INTTX0 interrupt request)
Figure 7-9 Transmitting Operation in I/O Interface Mode (SCLK input mode)
Page 135
2007-10-10
TMP91FU62
7.4.1.2
Receiving
In SCLK output mode, the synchronous clock is outputted from SCLK0 pin and the data is shifted to receiving buffer 1. This starts when the receive interrupt flag INTES0 is cleared by reading the received data. When 8-bit data are received, the data will be transmitted to receiving buffer 2 (SC0BUF according to the timing shown below) and INTES0 will be set to generate INTRX0 interrupt. The outputting for the first SCLK0 starts by setting SC0MOD0 to "1".
IRX0C (INTRX0 interrupt request) SCLK0 output ( = 0: Rising edge mode) SCLK0 output ( = 1: Falling edge mode) RXD0
Bit 0
Bit 1
Bit 6
Bit 7
Figure 7-10 Receiving Operation in I/O Interface Mode (SCLK output mode)
In SCLK input mode, the data is shifted to receiving buffer 1 when the SCLK input becomes active after the receive interrupt flag INTES0 is cleared by reading the received data. When 8-bit data is received, the data will be shifted to receiving buffer 2 (SC0BUF according to the timing shown below) and INTES0 will be set again to be generate INTRX0 interrupt.
SCLK0 input ( = 0: Rising edge mode) SCLK0 input ( = 1: Falling edge mode) Bit 0 Bit 1 Bit 5 Bit 6 Bit 7
RXD1 IRX0C (INTRX0 interrupt request)
Figure 7-11 Receiving Operation in I/O Interface Mode (SCLK input mode)
Note: The system must be put in the receive enable state (SC0MOD0 = 1) before data can be received.
Page 136
2007-10-10
TMP91FU62
7.4.1.3
Transmission and receiving (Full duplex mode)
When the full duplex mode is used, set the level of receive interrupt to "0" and set enable the interrupt level (1 to 6) to the transmission interrupt. In the transmission interrupt program, the receiving operation should be done like the above example before setting the next transmission data. Example: Channel 0, SCLK output Baud rate = 9600 bps fc = 14.7456 MHz
*Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) fFPH
port setting 7 INTES0 SC0MOD0 SC0MOD1 SC0CR X - - - 6 0 - 1 - 5 0 - X - 4 1 - X - 3 0 0 X - 2 0 0 X - 1 0 - X 0 0 0 - X 0 Set the INTTX0 level to 1. Set the INTRX0 level to 0. Select I/O interface mode. Select full duplex mode. SCLK0 output mode, transmit on falling edge mode, receive on rising edge mode. BR0CR SC0MOD0 SC0BUF 0 - * 0 - * 1 1 * 1 - * 0 - * 0 - * 1 - * 1 - * Baud rate = 9600 bps Enable receiving Set the transmit data and start.
7 Acc SC0BUF SC0BUF *
6
5
4
3
2
1
0 Read the receiving buffer.
*
*
*
*
*
*
*
Set the next transmission data.
Note: X: Don't care, -: No change, *: Data
Page 137
2007-10-10
TMP91FU62
7.4.2
Mode 1 (7-bit UART mode)
7-bit UART mode is selected by setting serial channel mode register SC0MOD0 to "01". In this mode, a parity bit can be added. Use of a parity bit is enabled or disabled by the setting of the serial channel control register SC0CR bit; whether even parity or odd parity will be used is determined by the SC0CR setting when SC0CR is set to "1" (Enabled).
Example: When transmission data of the following format, the control registers should be set as described below. This explanation applies to channel 0.
Start Bit 0 1 2 3 4 5 6
Even parity
Stop
Transmission direction (Transmission rate: 2400 bps at fc = 12.288 MHz)
Figure 7-12 7-bit UART mode
*Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) System clock
7 SC0MOD0 SC0CR BR0CR INTES0 SC0BUF - - 0 X *
6 - 1 0 1 *
5 - 1 1 0 *
4 - - 0 0 *
3 0 - 0 - *
2 1 - 1 - *
1 0 - 0 - *
0 1 - 1 - * Select 7-bit UART mode. Add even parity. Set the transmission rate to 2400 bps. Enable the INTTX0 interrupt and set it to interrupt level 4. Set data for transmission.
Note:X: Don't care, -: No change, *: Data
Page 138
2007-10-10
TMP91FU62
7.4.3
Mode 2 (8-bit UART mode)
8-bit UART mode is selected by setting SC0MOD0 to "10". In this mode, a parity bit can be added (Use of a parity bit is enabled or disabled by the setting of SC0CR); whether even parity or odd parity will be used is determined by the SC0CR setting when SC0CR is set to "1" (Enabled). Example: When receiving data of the following format, the control registers should be set as described below.
Start Bit 0 1 2 3 4 5 6 7
Odd parity
Stop
Transmission direction (Transmission rate: 9600 bps at fc = 12.288 MHz)
Figure 7-13 8-bit UART mode
*Clock state
System clock: Clock gear: Prescaler clock:
High frequency (fc) 1 (fc) System clock
7 SC0MOD0 SC0CR BR0CR INTES0 - - 0 -
6 - 0 0 -
5 1 1 0 -
4 - - 1 -
3 1 - 0 X
2 0 - 1 1
1 0 - 0 0
0 1 - 1 0 Enable receiving in 8-bit UART mode. Add odd parity. Set the transmission rate to 9600 bps. Enable the INTTX0 interrupt and set it to interrupt level 4.
Note:X: Don't care, -: No change
Acc SC0CR AND 00011100 if Acc 0 then ERROR Acc SC0BUF
Check for errors. Read the received data.
Page 139
2007-10-10
TMP91FU62
7.4.4
Mode 3 (9-bit UART mode)
9-bit UART mode is selected by setting SC0MOD0 to "11". In this mode parity bit cannot be added. In the case of transmission, the MSB (9th bit) is written to SC0MOD0. In the case of receiving, it is stored in SC0CR. When the buffer is written and read, the MSB is read or written first, before the rest of the SC0BUF data.
7.4.4.1
Wakeup function
In 9-bit UART mode, the wakeup function for slave controllers is enabled by setting SC0MOD0 to "1". The interrupt INTRX0 occurs only when = "1".
TXD
RXD
TXD
RXD
TXD
RXD
TXD
RXD
Note: The TXD pin of each slave controller must be in open-drain output mode.
Figure 7-14 Serial Link Using Wakeup Function
Page 140
2007-10-10
TMP91FU62
7.4.4.2
Protocol
1. Select 9-bit UART mode on the master and slave controllers. 2. Set the SC0MOD0 bit on each slave controller to "1" to enable data receiving. 3. The master controller transmits one-frame data including the 8-bit select code for the slave controllers. The MSB (Bit8) is set to "1".
Start
Bit 0
1
2
3
4
5
6
7
8
"1"
Stop
Select code of slave controller
4. Each slave controller receives the above frame. Each controller checks the above select code against its own select code. The controller whose code matches clears its WU bit to "0". 5. The master controller transmits data to the specified slave controller whose SC0MOD0 bit is cleared to "0". The MSB (Bit8) is cleared to "0".
Start
Bit 0
1
2
3
4
5
6
7
Bit 8
"0"
Stop
6. The other slave controllers (whose bits remain at "1") ignore the received data because their MSBs (Bit8 or ) are set to "0", disabling INTRX0 interrupts. The slave controller (WU bit = "0") can transmit data to the master controller, and it is possible to indicate the end of data receiving to the master controller by this transmission.
Page 141
2007-10-10
TMP91FU62
7.4.4.3
Example
To link two slave controllers serially with the master controller using the internal clock fSYS as the transfer clock.
TXD
RXD
TXD
RXD
TXD
RXD
00000001
00001010
Main settings (except port setting)
Register MSB 7 INTES0 SC0MOD0 SC0BUF X 1 0 6 1 0 0 5 0 1 0 4 0 0 0 3 X 1 0 2 1 1 0 1 0 1 0 LSB 0 1 0 1 Enable the INTTX0 interrupt and set it to interrupt level 4. Enable the INTRX0 interrupt and set it to interrupt level 5. Set fSYS as the transmission clock for 9-bit UART mode. Set the select code for slave controller 1.
INTTX0 interrupt
Register MSB 7 SC0MOD0 SC0BUF 0 * 6 - * 5 - * 4 - * 3 - * 2 - * 1 - * LSB 0 - * Set TB8 to "0". Set data for transmission.
Main settings (except port setting)
Register MSB 7 INTES0 SC0MOD0 X 0 6 1 0 5 0 1 4 1 1 3 X 1 2 1 1 1 1 1 LSB 0 0 0 Enable INTRX0 and INTTX0. Set to "1" in 9-bit UART transmission mode using fSYS as the transmission clock.
INTRX0 interrupt
Register MSB 7 6 5 4 3 2 1 LSB 0
Acc SC0BUF, if Acc = select code then SC0MOD0 - - - 0 - - - - Clear to "0".
Page 142
2007-10-10
TMP91FU62
8. Serial Bus Interface (SBI)
The TMP91FU62 has a 1-channel serial bus interface which an I2C bus mode. This circuit supports only I2C bus mode (Multi master). The serial bus interface is connected to an external device through SDA0 and SCL0 in the I2C bus mode.
8.1 Configuration
INTSBI0 interrupt request SCL
output control Transfer control circuit I2C bus SDA SDA0
T
Divider I2C bus clock sysn. Control
SCL0
Noise canceller
SBI0CR2/ SBI0SR SBI0 control register 2/ SBI0 status register
I2C0AR
I2C bus/ address register
SBI0DBR
SBI0 data/ buffer register
SBI0CR1
SBI0 control register 1
SBI0BR
SBI0 baud rate register
Figure 8-1 Serial Bus Interface (SBI)
8.2 Serial Bus Interface (SBI) Control
The following registers are used to control the serial bus interface and monitor the operation status. * Serial bus interface control register 0 (SBI0CR0) * Serial bus interface control register 1 (SBI0CR1) * Serial bus interface control register 2 (SBI0CR2) * Serial bus interface data buffer register (SBI0DBR) * I2C bus address register (I2C0AR) * Serial bus interface status register (SBI0SR) * IDLE2 control register (SBI0BR)
Page 143
2007-10-10
TMP91FU62
8.3 Operation in I2C Bus Mode
8.3.1 The Data Formats in the I2C Bus Mode
The data formats in the I2C bus mode is shown below.
(a) Addressing format 8 bits 1 1 to 8 bits Data 1 A C K 1 or more 1 to 8 bits Data 1 A CP K
RA S Slave address / C WK 1 (b) Addressing format (with restart) 8 bits 1
1 to 8 bits Data 1 or more
1
8 bits
1
1 to 8 bits Data 1 or more
1 A CP K
RA S Slave address / C WK 1
A RA C S Slave address / C K WK 1
(c) Free data format (Data transferred from master device to slave device) 8 bits S Data 1 S R/W ACK P : Start condition : Direction bit : Acknowledge bit : Stop condition 1 A C K 1 to 8 bits Data 1 A C K 1 or more 1 to 8 bits Data 1 A CP K
Figure 8-2 Data Format in the I2C Bus Mode
Page 144
2007-10-10
TMP91FU62
8.3.2
I2C Bus Mode Control Register
The following registers are used to control and monitor the operation status when using the serial bus interface (SBI) in the I2C bus mode.
Serial Bus Interface Control Register 0 (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0CR0 (0247H) Read/Write After reset SBI0EN R/W 0 SBI operation 0: disable 1: enable 0 0 0 6 - 5 - 4 - 3 - R 0 0 0 0 2 - 1 - 0 -
Function
Always read "0".
Note : When using SBI, should be set "1" (SBI operation enable) before setting each register of SBI module.
Serial Bus Interface Control Register 1 (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0CR1 (0240H) Read/Write After reset 0 BC2 6 BC1 W 0 Number of transferred bits (Note 1) 0 5 BC0 4 ACK R/W 0 Acknowledge mode specification 3 - - - 0 2 SCK2 W 0 1 SCK1 0 SCK0/ SWRMON R/W 0/1
Function
Internal serial clock selection and software reset monitor (Note 2)
Internal serial clock selection at write
000 001 010 011 SCK2:0 100 101 110 111 n=8 n=9 n = 10 (Reserved) 17.12 kHz 9.12 kHz 4.72 kHz (Reserved) n=4 n=5 n=6 n=7 - (Note3) 73.53 kHz 50.00 kHz 30.49 kHz System clock: fc Clock gear: fc/1 fc =20 MHz (Internal SCL output) fscl = (fSYS/2) / (2n+36) [Hz]
Software reset state monitor at read
0 SWRMON 1 Initial data During software reset
Acknowledge mode specification
0 ACK 1 Generate clock pulse for acknowledge signal Not generate clock pulse for acknowledge signal
Page 145
2007-10-10
TMP91FU62
Number of bits transferred
= 0 Number of clock pulses 8 1 2 3 4 5 6 7 Bits 8 1 2 3 4 5 6 7 = 1 Number of clock pulses 9 2 3 4 5 6 7 8 Bits 8 1 2 3 4 5 6 7
000 001 BC2:0 010 011 100 101 110 111
Note 1: For the frequency of the SCL line clock, see 8.3.3.3 "Serial clock". Note 2: Initial data of SCK0 is "0",SWRMON is "1". Note 3: This I2C bus circuit dose not support high-speed mode, it supports standard mode only. The fscl speed can be selected over 100 kbps by fc and , however it's irregular operation.
Page 146
2007-10-10
TMP91FU62
Serial Bus Interface Control Register 2 (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0CR2 (0243H) Read/Write After reset 0 0 Transmitter/ receiver selection MST 6 TRX W 0 Start/stop condition generation 1 Cancel INTSBI interrupt request 0 5 BB 4 PIN 3 SBIM1 W 0 0 2 SBIM0 1 SWRST1 W 0 0 SWRST0
Function
Master/slave selection
Serial bus interface operation mode selection
Software reset generate
Software reset generate
SWRST1:0 10 01 Write "10" and "01", then an internal reset signal is generated
Serial bus interface operating mode selection (Note 2)
00 01 SBIM1:0 10 11 Port mode (Serial bus interface output disabled) (Reserved) I2C bus mode (Reserved)
INTSBI interrupt request
0 PIN 1 Cancel interrupt request -
Start/stop condition generation
0 BB 1 Generates the start condition Generates the stop condition
Transmitter/receiver selection
0 TRX 1 Transmitter Receiver
Master/slave selection
0 MST 1 Master Slave
Note 1: Reading this register functions as SBI0SR register. Note 2: Switch to port mode after confirming that the bus is free. Switch a mode between I2C bus mode and clocked-synchronous 8-bit SIO mode after confirming that input signals via port are high level.
Page 147
2007-10-10
TMP91FU62
Serial Bus Interface Status Register (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0SR (0243H) Read/Write After reset 0 Master/slave status monitor 0 Transmitter/ receiver status monitor 0 I2C bus status monitor 1 INTSBI interrupt request monitor MST 6 TRX 5 BB 4 PIN R 0 Arbitration lost detection monitor 0 Slave address match detection monitor 0 GENERAL CALL detection monitor 0 Last received bit monitor 3 AL 2 AAS 1 AD0 0 LRB
Function
Last received bit monitor
0 LRB 1 Last received bit was 1 Last received bit was 0
GENERAL CALL detection monitor
0 AD0 1 GENERAL CALL detected Undetected
Slave address match detection monitor
0 AAS 1 Slave address match or GENERAL CALL detected Undetected
Arbitration lost detection monitor
0 AL 1 Arbitration lost detected -
INTSBI interrupt request monitor
0 PIN 1 Interrupt canceled Interrupt requested
I2C bus status monitor
0 BB 1 Busy Free
Transmitter/receiver status monitor
0 TRX 1 Transmitter Receiver
Master/slave status monitor
0 MST 1 Master Slave
Note 1: Writing in this register functions as SBI0CR2. Note 2: The initial data SBI0SR is "1" if SBI operation is enable (SBI0CR0 "1"). If SBI operation is disable (SBI0CR0 "0"), the initial data of SBI0SR is "0".
Page 148
2007-10-10
TMP91FU62
IDLE2 Control Register (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0BR (0244H) Read/Write After reset - W 0 6 I2SBI0 R/W 0 Operation in IDLE2 mode 0: Stop 1: Operate 5 - - - 4 - - - 3 - - - 2 - - - 1 - - - 0 - R/W 0
Function
Always write "0"
Always write "0"
Serial Bus Interface Data Buffer Register (Read-modify-write instructions are prohibited.)
7 Bit symbol SBI0DBR (0241H) Read/Write After reset DB7 6 DB6 5 DB5 4 DB4 3 DB3 2 DB2 1 DB1 0 DB0
R (Received)/W (Transfer) Undefined
Note 1: When writing transmitted data, start from the MSB (bit7).Receiving data is placed from LSB (bit0). Note 2: SBI0DBR can't be read the written data. Therefore read-modify-write instruction (e.g., "BIT" instruction) is prohibitted.
I2C Bus Address Register (Read-modify-write instructions are prohibited.)
7 Bit symbol I2C0AR (0242H) Read/Write After reset 0 0 0 0 SA6 6 SA5 5 SA4 4 SA3 W 0 0 0 0 Address recognition mode specification 3 SA2 2 SA1 1 SA0 0 ALS
Function
Slave address selection for when device is operating as slave device
Address recognition mode specification
0 ALS 1 Non slave address recognition Slave address recognition
Page 149
2007-10-10
TMP91FU62
8.3.3
Control in I2C Bus Mode
Acknowledge mode specification
Set the SBI0CR1 to "1" for operation in the acknowledge mode. The TMP91FU62 generates an additional clock pulse for an acknowledge signal when operating in master mode. In the transmitter mode during the clock pulse cycle, the SDA pin is released in order to receive the acknowledge signal from the receiver. In the receiver mode during the clock pulse cycle, the SDA pin is set to the low in order to generate the acknowledge signal. Clear the to "0" for operation in the non-acknowledge mode, the TMP91FU62 does not generate a clock pulse for the acknowledge signal when operating in the master mode.
8.3.3.1
8.3.3.2
Number of transfer bits
The SBI0CR1 is used to select a number of bits for next transmitting and receiving data. Since the is cleared to "000" as a start condition, a slave address and direction bit transmission are always executed in 8 bits. Other than these, the retains a specified value.
8.3.3.3
Serial clock
(1) Clock source The SBI0CR1 is used to select a maximum transfer frequency outputted on the SCL pin in master mode. Set the baud rates, which have been calculated according to the formula below, to meet the specifications of the I2C bus, such as the smallest pulse width of tLOW.
tHIGH tLOW 1/fscl
Figure 8-3 Clock Source
SBI0CR1 tLOW = (2n - 1+29)/fSBI tHIGH = (2n - 1+7)/fSBI fscl = 1/(tLOW + tHIGH) = fSBI/(2n + 36) 000 001 010 011 100 101 110
n 4 5 6 7 8 9 10
Note: fSBI shows fSYS/2
Page 150
2007-10-10
TMP91FU62
(2)
Clock synchronization In the I2C bus mode, in order to wired-AND a bus, a master device which pulls down a clock line to low level, in the first place, invalidate a clock pulse of another master device which generates a high-level clock pulse. The master device with a high-level clock pulse needs to detect the situation and implement the following procedure. The TMP91FU62 has a clock synchronization function for normal data transfer even when more than one master exists on the bus. The example explains the clock synchronization procedures when two masters simultaneously exist on a bus.
Wait counting high-level width of a clock pulse Start counting high-level width of a clock pulse
Internal SCL output (Master A) Internal SCL output (Master B) SCL pin a b c Reset a counter of high-level width of a clock pulse
Figure 8-4 Clock Synchronization
As master A pulls down the internal SCL output to the low level at point "a", the SCL line of the bus becomes the low level. After detecting this situation, master B resets a counter of high-level width of an own clock pulse and sets the internal SCL output to the low level. Master A finishes counting low-level width of an own clock pulse at point "b" and sets the internal SCL output to the high level. Since master B holds the SCL line of the bus at the low level, master A waits for counting high-level width of an own clock pulse. After master B finishes counting lowlevel width of an own clock pulse at point "c" and master A detects the SCL line of the bus at the high level, and starts counting high level of an own clock pulse. The clock pulse on the bus is determined by the master device with the shortest high-level width and the master device with the longest low-level width from among those master devices connected to the bus.
8.3.3.4
Slave address and address recognition mode specification
When the TMP91FU62 is used as a slave device, set the slave address and to the I2C0AR. Clear the to "0" for the address recognition mode.
8.3.3.5
Master/slave selection
Set the SBI0CR2 to "1" for operating the TMP91FU62 as a master device. Clear the SBI0CR2 to "0" for operation as a slave device. The is cleared to "0" by the hardware after a stop condition on the bus is detected or arbitration is lost.
Page 151
2007-10-10
TMP91FU62
8.3.3.6
Transmitter/receiver selection
Set the SBI0CR2 to "1" for operating the TMP91FU62 as a transmitter. Clear the to "0" for operation as a receiver. When data with an addressing format is transferred in slave mode, when a slave address with the same value that an I2C0AR or a GENERAL CALL is received (All 8-bit data are "0" after a start condition), the is set to "1" by the hardware if the direction bit (R/W) sent from the master device is "1", and is cleared to "0" by the hardware if direction bit is "0". In the master mode, after an acknowledge signal is returned from the slave device, the is cleared to "0" by the hardware if a transmitted direction bit is "1", and is set to "1" by the hardware if direction is "0". When an acknowledge signal is not returned, the current condition is maintained. The is cleared to "0" by the hardware after a stop condition on the I2C bus is detected or arbitration is lost.
8.3.3.7
Start/stop condition generation
When the SBI0SR is "0", slave address and direction bit which are set to SBI0DBR are output on a bus after generating a start condition by writing "1" to the SBI0CR2. It is necessary to set transmitted data to the data buffer register (SBI0DBR) and set "1" to beforehand.
SCL pin
1
2
3
4
5
6
7
8
9
SDA pin Start condition
A6
A5
A4
A3
A2
A1
A0
R/W
Acknowledge signal
Slave address and the direction bit
Figure 8-5 Start Condition Generation and Slave Address Generation
When the is "1", a sequence of generating a stop condition is started on the bus by writing "1" to the , and "0" to the . Do not modify the contents of until a stop condition is generated on the bus.
SCL pin
SDA pin Stop condition
Figure 8-6 Stop Condition Generation
The state of the bus can be ascertained by reading the contents of SBI0SR. SBI0SR will be set to "1" if a start condition has been detected on the bus, and will be cleared to "0" if a stop condition has been detected.
Page 152
2007-10-10
TMP91FU62
8.3.3.8
Interrupt service requests and interrupt cancellation
When a serial bus interface interrupt request (INTSBI) occurs, the SBI0CR2 is cleared to "0". During the time that the SBI0CR2 is "0", the SCL line is pulled down to the low level. The is cleared to "0" when an 1 word of data is transmitted or received. Either writing/reading data to/from SBI0DBR sets the to "1". The time from the being set to "1" until the SCL line is released takes tLOW. In the address recognition mode ( = "0"), is cleared to "0" when the received slave address is the same as the value set at the I2C0AR or when a GENERAL CALL is received (All 8-bit data are "0" after a start condition). Although SBI0CR2 can be set to "1" by the program, the is not cleared to "0" when it is written "0".
8.3.3.9
Serial bus interface operation mode selection
SBI0CR2 is used to specify the serial bus interface operation mode. Set SBI0CR2 to "10" when the device is to be used in I2C bus mode after confirming pin condition of serial bus interface to "H". Switch to port mode after confirming a bus is free.
8.3.3.10 Arbitration lost detection monitor
Since more than one master device can exist simultaneously on the bus in I2C bus mode, a bus arbitration procedure has been implemented in order to guarantee the integrity of transferred data. Data on the SDA line is used for I2C bus arbitration. The following shows an example of a bus arbitration procedure when two master devices exist simultaneously on the bus. Master A and master B output the same data until point "a". After master A outputs "L" and master B, "H", the SDA line of the bus is wired-AND and the SDA line is pulled down to the low level by master A. When the SCL line of the bus is pulled up at point b, the slave device reads the data on the SDA line, that is, data in master A. A data transmitted from master B becomes invalid. The state in master B is called "ARBITRATION LOST". Master B device which loses arbitration releases the internal SDA output in order not to affect data transmitted from other masters with arbitration. When more than one master sends the same data at the first word, arbitration occurs continuously after the second word.
SCL pin
Internal SDA output (Master A) Internal SDA output (Master B) SDA pin a b
Internal SDA output becomes 1 after arbitration has been lost.
Figure 8-7 Arbitration Lost
The TMP91FU62 compares the levels on the bus's SDA line with those of the internal SDA output on the rising edge of the SCL line. If the levels do not match, arbitration is lost and SBI0SR is set to "1".
Page 153
2007-10-10
TMP91FU62
When SBI0SR is set to "1", SBI0SR are cleared to "00" and the mode is switched to slave receiver mode. Thus, clock output is stopped in data transfer after setting = "1". SBI0SR is cleared to "0" when data is written to or read from SBI0DBR or when data is written to SBI0CR2.
Internal SCL output Master A Internal SDA output Internal SCL output Master B Internal SDA output
1
2
3
4
5
6
7
8
9
1
2
3
4
D7A D6A
D5A
D4A D3A D2A D1A D0A Stop the clock pulse
D7A' D6A' D5A' D4A'
1
2
3
4
D7B D6B
Keep internal SDA output to high level as losing arbitration



Accessed to SBI0DBR or SBI0CR2
Figure 8-8 Example of when TMP91FU62 is a Master Device B (D7A = D7B, D6A = D6B)
8.3.3.11 Slave address match detection monitor
SBI0SR is set to "1" in slave mode, in address recognition mode (e.g., when I2C0AR = "0"), when a GENERAL CALL is received, or when a slave address matches the value set in I2C0AR. When I2C0AR = "1", SBI0SR is set to "1" after the first word of data has been received. SBI0SR is cleared to "0" when data is written to or read from the data buffer register SBI0DBR.
8.3.3.12 GENERAL CALL detection monitor
SBI0SR is set to "1" in slave mode, when a GENERAL CALL is received (All 8-bit received data is "0" after a start condition). SBI0SR is cleared to "0" when a start condition or stop condition is detected on the bus.
8.3.3.13 Last received bit monitor
The SDA line value stored at the rising edge of the SCL line is set to the SBI0SR. In the acknowledge mode, immediately after an INTSBI interrupt request is generated, an acknowledge signal is read by reading the contents of the SBI0SR.
8.3.3.14 Software reset function
The software reset function is used to initialize the SBI circuit, when SBI is locked by external noises, etc. An internal reset signal pulse can be generated by setting SBI0CR2 to "10" and "01". This initializes the SBI circuit internally. All control registers and status registers are initialized as well. SBI0CR1 is automatically set to "1" after the SBI circuit has been initialized.
Note: If the software reset is executed, operation selection is reset, and its mode is set to port mode from I2C mode.
Page 154
2007-10-10
TMP91FU62
8.3.3.15 Serial bus interface data buffer register (SBI0DBR)
The received data can be read and transferred data can be written by reading or writing the SBI0DBR. In the master mode, after the start condition is generated the slave address and the direction bit are set in this register.
8.3.3.16 I2CBUS address register (I2C0AR)
I2C0AR is used to set the slave address when the TMP91FU62 functions as a slave device. The slave address output from the master device is recognized by setting the I2C0AR to "0". The data format is the addressing format. When the slave address is not recognized at the = "1", the data format is the free data format.
8.3.3.17 Setting register for IDLE2 mode operation (SBI0BR0)
SBI0BR0 is the register setting operation/stop during IDLE2 mode. Therefore, setting is necessary before the HALT instruction is executed.
8.3.4
Data Transfer in I2C Bus Mode
Device initialization
Set the SBI0CR1, clear bits 2 to 0 and 4 in the SBI0CR1 to "0". Set a slave address and the ( = "0" when an addressing format) to the I2C0AR. For specifying the default setting to a slave receiver mode, clear "0" to the SBI0CR2, set "1" to the , "10" to the , and write "0" to bit 1, 0.
8.3.4.1
7 SBI0CR1 I2C0AR SBI0CR2
6 X X 0
5 X X 0
4 0 X 1
3 X X 1
2 0 X 0
1 0 X 0
0 0 0 0 Set acknowledge and SCL clock. Set slave address and address recognition mode. Set to slave receiver mode.

X X 0
Note: X: Don't care
Page 155
2007-10-10
TMP91FU62
8.3.4.2
Start condition and slave address generation
(1) Master mode In the master mode, the start condition and the slave address are generated as follows. Check a bus free status (when = "0"). Set the SBI0CR1 to "1" (Acknowledge mode) and specify a slave address and a direction bit to be transmitted to the SBI0DBR. When SBI0CR2 = "0", the start condition are generated by writing "1" to SBI0CR2. Subsequently to the start condition, nine clocks are output from the SCL pin. While eight clocks are output, the slave address and the direction bit which are set to the SBI0DBR. At the 9th clock, the SDA line is released and the acknowledge signal is received from the slave device. An INTSBI0 interrupt request occurs at the falling edge of the 9th clock. The is cleared to "0". In the master mode, the SCL pin is pulled down to the low level while is "0". When an interrupt request occurs, the is changed according to the direction bit only when an acknowledge signal is returned from the slave device.
Setting in main routine 7 Reg Reg if Reg Then SBI0CR1 SBI0DBR SBI0CR2 6 5 4 3 2 1 0

SBI0SR Reg. 0X20 Wait until bus is free.
0x00
X X 1
X X 1
X X 1
1 X 1
X X 1
0 X 0
0 X 0
0 X 0
Set to acknowledgement mode. Set slave address and direction bit. Generate start condition.
In INTSBI0 interrupt routine INTCLR <-- 0x30 Process End of interrupt ; Clear the interrupt request
(2)
Slave mode In the slave mode, the start condition and the slave address are received. After the start condition is received from the master device, while eight clocks are output from the SCL pin, the slave address and the direction bit which are output from the master device are received. When a GENERAL CALL or the same address as the slave address set in I2C0AR is received, the SDA line is pulled down to the low level at the 9th clock, and the acknowledge signal is output. An INTSBI0 interrupt request occurs on the falling edge of the 9th clock. The is cleared to "0". In slave mode the SCL line is pulled down to the low level while the = "0".
Page 156
2007-10-10
TMP91FU62
SCL pin
1
2
3
4
5
6
7
8
9
SDA pin
A6
Start condition
A5
A4
A3
A2
A1
A0
R/W
ACK
Acknowledge signal from a slave device
Slave address + Direction bit

INTSBI interrupt request Output of master Output of slave
Figure 8-9 Start Condition Generation and Slave Address Transfer
8.3.4.3
1-word data transfer
Check the by the INTSBI0 interrupt process after the 1-word data transfer is completed, and determine whether the mode is a master or slave.
(1)
If = "1" (Master mode) Check the and determine whether the mode is a transmitter or receiver.
(a) When the = "1" (Transmitter mode) Check the . When is "1", a receiver does not request data. Implement the process to generate a stop condition (Refer to below) and terminate data transfer. When the is "0", the receiver requests new data. When the next transmitted data is 8 bits, write the transmitted data to SBI0DBR. When the next transmitted data is other than 8 bits, set the and write the transmitted data to SBI0DBR. After written the data, becomes "1", a serial clock pulse is generated for transferring a new 1 word of data from the SCL pin, and then the 1-word data is transmitted. After the data is transmitted, an INTSBI interrupt request occurs. The becomes "0" and the SCL line is pulled down to the low level. If the data to be transferred is more than one word in length, repeat the procedure from the checking above.
if MST = 0 Then shift to the process when slave mode if TRX = 0 Then shift to the process when receiver mode. if LRB = 0 Then shift to the process that generates stop condition. 7 SBI0CR1 SBI0DBR 6 0 X 5 0 X 4 1 X 3 X X 2 X X 1 X X 0 X X Set the bit number of transmit and ACK. Write the transmit data.

0 X
End of interrupt Note: X: Don't care
Page 157
2007-10-10
TMP91FU62
SCL pin Write to SBI0DBR SDA pin
1
2
3
4
5
6
7
8
9
D7
D6
D5
D4
D3
D2
D1
D0
ACK
Acknowledge signal from a receiver

INTSBI interrupt request Output from master Output from slave
Figure 8-10 Example in which = "000" and = "1" in Transmitter Mode
(b) When the is "0" (Receiver mode) When the next transmitted data is other than 8 bits, set and read the received data from SBI0DBR to release the SCL line (Data which is read immediately after a slave address is sent is undefined). After the data is read, becomes "1". Serial clock pulse for transferring new 1 word of data is defined SCL and outputs "L" level from SDA pin with acknowledge timing. An INTSBI0 interrupt request then occurs and the becomes "0", then the TMP91FU62 pulls down the SCL pin to the low level. The TMP91FU62 outputs a clock pulse for 1 word of data transfer and the acknowledge signal each time that received data is read from the SBI0DBR.
Read SBI0DBR SCL pin
1
2
3
4
5
6
7
8
9
SDA pin
D7
D6
D5
D4
D3
D2
D1
D0
ACK
D7 Acknowledge signal to a

INTSBI interrupt request Output from master Output from slave
Figure 8-11 Example of when = "000", = "1" in Receiver Mode
In order to terminate the transmission of data to a transmitter, clear to "0" before reading data which is 1 word before the last data to be received. The last data word does not generate a clock pulse as the acknowledge signal. After the data has been transmitted and an interrupt request has been generated, set to "001" and read the data. The TMP91FU62 generates a clock pulse for an 1-bit data transfer. Since the master device is a receiver, the SDA line on the bus remains high. The transmitter interprets the high signal as an ACK signal. The receiver indicates to the transmitter that data transfer is complete. After the one data bit has been received and an interrupt request been generated, the TMP91FU62 generates a stop condition and terminates data transfer.
Page 158
2007-10-10
TMP91FU62
SCL pin
9
1
2
3
4
5
6
7
8
1
SDA pin
D7
D6
D5
D4
D3
D2
D1
D0
Acknowledge sig sent to a transmit

INTSBI interrupt request "0" Read SBI0DBR
"001" Read SBI0DBR Output of master Output of slave
Figure 8-12 Termination of Data Transfer in Master Receiver Mode
Example: In case receive data N times INTSBI0 interrupt (After transmitting data) 7 SBI0CR1 Reg. 6 X 5 X 4 X 3 X 2 X 1 X 0 X Set the bit number of receive data and ACK. Load the dummy data.

X
SBI0DBR
End of interrupt INTSBI0 interrupt (Receive data of 1st to (N 2) th) 7 Reg. 6 5 4 3 2 1 0 Load the data of 1st to (N 2)th.
SBI0DBR
End of interrupt INTSBI0 interrupt ((N 1) th Receive data) 7 SBI0CR1 Reg. 6 X 5 X 4 0 3 0 2 X 1 X 0 X Not generate acknowledge signal Load the data of (N 1)th

X
SBI0DBR
End of interrupt INTSBI0 interrupt (Nth Receive data) 7 SBI0CR1 Reg. 6 0 5 1 4 0 3 0 2 X 1 X 0 X Generate the clock for 1bit transmit Receive the data of Nth.

0
SBI0DBR
End of interrupt INTSBI0 interrupt (After receiving data) The process of generating stop condition End of interrupt Note: X: Don't care Finish the transmit of data
(2)
If = 0 (Slave mode) In the slave mode the TMP91FU62 operates either in normal slave mode or in slave mode after losing arbitration. In the slave mode, an INTSBI0 interrupt request occurs when the TMP91FU62 receives a slave address or a GENERAL CALL from the master device, or when a GENERAL CALL is received and data transfer is complete, or after matching received address. In the master mode, the TMP91FU62 operates in a slave mode if it detects losing arbitration. An INTSBI0 interrupt request occurs when a word data transfer terminates after losing arbitration. When an INTSBI0 interrupt request occurs the is cleared to "0" and the SCL pin is pulled down to the low level. Either reading/writing from/ to the SBI0DBR or setting the to "1" will release the SCL pin after taking tLOW time. Check the SBI0SR, , , and and implements processes according to conditions listed in the next table. Page 159
2007-10-10
TMP91FU62
Example: In case matching slave address in slave receive mode, direction bit is "1". INTSBI0 interrupt if TRX = 0 Then shift to other process if AL = 1 Then shift to other process if AAS = 0 Then shift to other process 7 SBI0CR1 SBI0DBR 6 X X 5 X X 4 1 X 3 X X 2 X X 1 X X 0 X X Set the bit number of transmit. Set the data of transmit.

X X
Note: X: Don't care
Table 8-1

Operation in the Slave Mode
Conditions The TMP91FU62 loses arbitration when transmitting a slave address and receives a slave address for which the value of the direction bit sent from another master is "1". In slave receiver mode, the TMP91FU62 receives a slave address for which the value of the direction bit sent from the master is "1". Process
1
1
0
Set the number of bits a word in and write the transmitted data to SBI0DBR.
1 1
0
0 0 0 In slave transmitter mode, a single word of data is transmitted.
Check the setting. If is set to "1", set to "1" since the receiver win no request the data which follows. Then, clear to "0" to release the bus. If is cleared to "0", set to the number of bits in a word and write the transmitted data to SBI0DBR since the receiver requests next data.
1 1
1/0
The TMP91FU62 loses arbitration when transmitting a slave address and receives a slave address or GENERAL CALL for which the value of the direction bit sent from another master is "0". The TMP91FU62 loses arbitration when transmitting a slave address or data and terminates word data transfer. In slave receiver mode, the TMP91FU62 receives a slave address or GENERAL CALL for which the value of the direction bit sent from the master is "0". In slave receiver mode, the TMP91FU62 terminates receiving word data. Set to the number of bits in a word and read the received data from SBI0DBR. Read the SBI0DBR for setting the to "1" (Reading dummy data) or set the to "1".
0 0
0
1 0 0
1/0
1/0
Page 160
2007-10-10
TMP91FU62
8.3.4.4
Stop condition generation
When SBI0SR = "1", the sequence for generating a stop condition is started by writing "1" to SBI0CR2 and "0" to SBI0CR2. Do not modify the contents of SBI0CR2 until a stop condition has been generated on the bus. When the bus's SCL line has been pulled low by another device, the TMP91FU62 generates a stop condition when the other device has released the SCL line and SDA pin rising.
7 SBI0CR2
6 1
5 0
4 1
3 1
2 0
1 0
0 0 Generate stop condition.
1 "1" "0" "1"
1

Stop condition
Internal SCL
SDA pin

(Read)
Figure 8-13 Stop Condition Generation (Single master)
"1" "1" "0" "1" Internal SCL The case of pulled low by another device
Stop condition
SCL pin
SDA pin

(Read)
Figure 8-14 Condition Generation (Multi master)
Page 161
2007-10-10
TMP91FU62
8.3.4.5
Restart
Restart is used during data transfer between a master device and a slave to change the data transfer direction. The following description explains how to restart when the TMP91FU62 is in Master mode. Clear SBI0CR2 to "0" and set SBI0CR2 to "1" to release the bus. The SDA line remains High and the SCL pin is released. Since a stop condition has not been generated on the bus, other devices assume the bus to be in busy state. And confirm SCL pin, that SCL pin is released and become bus-free state by SBI0SR = "0" or signal level "1" of SCL pin by sensing its port (change to input mode). Check the until it becomes "1" to check that the SCL line on a bus is not pulled down to the low level by other devices. After confirming that the bus remains in a free state, generate a start condition using the procedure described in 8.3.4.2. In order to satisfy the setup time requirements when restarting, take at least 4.7 s of waiting time by software from the time of restarting to confirm that the bus is free until the time to generate the start condition.
7 SBI0CR2
6 0
5 0
4 1
3 1
2 0
1 0
0 0 Release the bus Check if SCL pin is released.
0
if SBI0SR 0 Then if SBI0SR 1 Then 4.7us Wait SBI0CR1 SBI0DBR SBI0CR2
Check if SCL pin of other device is "L" level.

0 X 1
0 X 1
0 X 1
1 X 1
0 X 1
X X 0
X X 0
X X 0
Set acknowledgement mode. Set the slave address and direction bit. Generate start condition.
Note: X: Don't care
"0" "0" "0" "1" SCL pin

"1" "1" "1" "1"

4.7s (Min)
Start condition
Internal SCL
9
SDA pin



Figure 8-15 Timing Diagram for TMP91FU62 Restart
Note: Don't write "0", when "0" condition. (Cannot be restarted)
Page 162
2007-10-10
TMP91FU62
9. 10-bit AD Converter (ADC)
The TMP91FU62 have a 10-bit successive approximation type AD converter.
9.1 Configuration
The circuit configuration of the 10-bit AD converter is shown in Figure 9-1. It consists of control register ADCCR1 and ADCCR2, converted value register ADCDRH and ADCDRL, a DA converter, a sample-hold circuit, a comparator, and a successive comparison circuit.
DA converter
Analog input multiplexer
Sample hold circuit
Reference voltage
Analog comparator Successive approximate circuit Shift clock Control circuit
AD converter control register 1, 2
AD conversion result register 1, 2
Note: Before using AD converter, set appropriate value to I/O port register combining a analog input port. For details, see the section on "I/O ports".
Figure 9-1 10-bit AD Converter
9.2 Register configuration
The AD converter consists of the following four registers: 1. AD converter control register 1 (ADCCR1) This register selects the analog channels and operation mode (single or repeat) in which to perform AD conversion and controls the AD converter as it starts operating. 2. AD converter control register 2 (ADCCR2) This register selects the AD conversion time and controls the connection of the DA converter (Ladder resistor network) and monitors the operating status of the AD converter. 3. AD converted value register (ADCDRH, ADCDRL) This register used to store the digital value after being converted by the AD converter.
Page 163
2007-10-10
TMP91FU62
AD Converter Control Register 1
7 Bit symbol ADCCR1 (02B0H) Read/Write After reset 0 AD conversion start 0: 1: AD conversion start 0 0 0 ADRS 6 AMD 5 4 AINEN R/W 0 0 0 0 3 2 SAIN 1 0
Function
AD operating mode 00: AD operation disable 01: single mode 10: Reserved 11: Repeat mode
Analog input channel select Analog input control 0:disable 1:enable 0000: AN0 0001: AN1 0010: AN2 0011: AN3 0100: AN4 0101: AN5 0110: AN6 0111: AN7 1000: AN8 1001: AN9 1010: AN10 1011: AN11 1100: AN12 1101: AN13 1110: AN14 1111: AN15
Note 1: Select analog input channel during AD converter stops (ADCCR2 = "0"). Note 2: When the analog input channel is all use disabling, the ADCCR1 should be set to "0". Note 3: During conversion, Do not perform port output instruction to maintain a precision for all of the pins because analog input port use as general input port. And for port near to analog input, Do not input intense signaling of change. Note 4: The ADCCR1 is automatically cleared to "0" after starting conversion. Note 5: Do not set ADCCR1 newly again during AD conversion. Before setting ADCCR1 newly again, check ADCDR2 to see that the conversion is completed or wait until the interrupt signal (INTADC) is generated (e.g., interrupt handling routine). Note 6: Starting of STOP mode, SLOW mode, and the IDLE1 mode initializes the AD control register 1 (ADCCR1) except for SAIN. Moreover, in the case of the IDLE2 mode, it controls by the bit of ADCCR2. Therefore, to use AD converter again, set the ADCCR1 newly after returning to NORMAL mode.
AD Converter Control Register 2 (Read-modify-write instructions are prohibited.)
7 Bit symbol ADCCR2 (02B1H) Read/Write After reset 0 AD conversion end flag 0:Before or during conversion 1: Conversion completed EOCF R 0 AD conversion BUSY flag 0: During stop of AD conversion 1: During AD conversion 0 0 1 6 ADBF 5 RSEL 4 I2AD R/W 1 0 0 3 2 ACK 1 0
AD conversion time select Storing of an AD conversion result 0: 10bit mode 1: 8bit mode IDLE2 control 0:Stop 1:Operation See" Table 9-1 ACK setting and Conversion time "
Function
Note 1: Starting of STOP mode, SLOW mode, and the IDLE1 mode initializes the AD control register 2 (ADCCR2) except for ACK and I2AD. Moreover, in the case of the IDLE2 mode, it controls by the bit of ADCCR2. Therefore, to use AD converter again, set the ADCCR2 newly after returning to NORMAL mode. Therefore, the AD conversion result should be read to ADCDRL more first than ADCDRH. Note 2: The ADCCR2 is cleared to "0" when reading the ADCDRH. Note 3: The ADCCR2 is set to "1" when AD conversion starts, and cleared to "0" when AD conversion finished.
Page 164
2007-10-10
TMP91FU62
Table 9-1 ACK setting and Conversion time
Condition ACK 0xxx 1000 1001 1010 1011 1100 1101 1110 1111 78/fc 156/fc 312/fc 624/fc 1248/fc Conversion time 20MHz 16MHz 10 MHz 8MHz 4 MHz
Reserved Reserved Reserved
- -
15.6 s 31.2 s 62.4 s
- -
19.5 s 39.0 s 78.0 s
-
15.6 s 31.2 s 62.4 s 124.8 s
-
19.5 s 39.0 s 78.0 s 156.0 s
19.5 s 39.0 s 78.0 s 156.0 s
-
Reserved
Note 1: Setting for "-" in the above table are inhibited.
fc: High Frequency oscillation clock [Hz]
Note 2: Set conversion time setting should be kept more than the following time by Analog reference voltage. -
AVCC = 4.5 to 5.5 V 15.6 us and more
AD Converted value Register H (8-bit storing mode)
7 Bit symbol ADCDRH (02B3H) Read/Write After reset 0 0 0 0 AD09 6 AD08 5 AD07 4 AD06 R 0 0 0 0 3 AD05 2 AD04 1 AD03 0 AD02
AD Converted value Register H (10-bit storing mode)
7 Bit symbol ADCDRH (02B3H) Read/Write After reset 0 0 0 0 6 5 4 3 2 1 AD09 0 AD08
-
-
-
-
R
-
-
0
0
0
0
AD Converted value Register L
7 Bit symbol ADCDRL (02B2H) Read/Write After reset 0 0 0 0 AD07 6 AD06 5 AD05 4 AD04 R 0 0 0 0 3 AD03 2 AD02 1 AD01 0 AD00
Note: At the time of 10-bit storing mode, if the bit 7 to 2 of ADCDRH is read, "0" will be read.
Page 165
2007-10-10
TMP91FU62
9.3
9.3.1
Function
Single mode
After setting ADCCR1 to "01" (single mode), set ADCCR1 to "1". AD conversion of the voltage at the analog input pin specified by ADCCR1 is thereby started. After completion of the AD conversion, the conversion result is stored in AD converted value registers (ADCDRH, ADCDRL) and at the same time ADCCR2 is set to 1, the AD conversion finished interrupt (INTADC) is generated. ADCCR1 is automatically cleared after AD conversion has started. Do not set ADCCR1 newly again (Restart) during AD conversion. Before setting ADCCR1 newly again, check ADCCR2 to see that the conversion is completed or wait until the interrupt signal (INTADC) is generated (e.g., interrupt handling routine).
AD conversion start AD conversion start
Indeterminate
1st conversion result
2nd conversion result EOCF cleared by reading conversion result
Conversion result read Conversion result read
Conversion result read Conversion result read
Figure 9-2 Single mode
Page 166
2007-10-10
TMP91FU62
9.3.2
Repeat Mode
AD conversion of the voltage at the analog input pin specified by ADCCR1 is performed repeatedly. In this mode, AD conversion is started by setting ADCCR1 to "1" after setting ADCCR1 to "11" (Repeat mode). After completion of the AD conversion, the conversion result is stored in AD converted value registers (ADCDRL, ADCDRH) and at the same time ADCCR2 is set to 1, the AD conversion finished interrupt (INTADC) is generated. In repeat mode, each time one AD conversion is completed, the next AD conversion is started. To stop AD conversion, set ADCCR1 to "00" (Disable mode) by writing 0s. The AD convert operation is stopped immediately. The converted value at this time is not stored in the AD converted value register.
When not performing conversion result read-out, EOCF is not cleared and a conversion result is not stored. Conversion operation
1st conversion result
2nd conversion result 3rd conversion result
AD convert operation suspended. Conversion result is not stored.
3rd conversion result
Indeterminate
1st conversion result
AD conversion start
Conversion result read
Figure 9-3 Repeat Mode
9.3.3
Register Setting
1. Set up the AD converter control register 1 (ADCCR1) as follows: * Choose the channel to AD convert using AD input channel select (SAIN). * Specify analog input enable for analog input control (AINDS). * Specify AMD for the AD converter control operation mode (ssingle or repeat mode). 2. Set up the AD converter control register 2 (ADCCR2) as follows: Set the AD conversion time using AD conversion time (ACK). For details on how to set the conversion time, refer to Table 9-1 and AD converter control register 2. 3. After setting up (1) and (2) above, set AD conversion start (ADRS) of AD converter control register 1 (ADCCR1) to "1". If software start mode has been selected, AD conversion starts immediately. 4. After an elapse of the specified AD conversion time, the AD converted value is stored in AD converted value register (ADCDRH and ADCDRL) and the AD conversion finished flag (EOCF) of AD converter control register 2 (ADCCR2) is set to "1", upon which time AD conversion interrupt INTADC is generated. 5. EOCF is cleared to "0" by a read of the conversion result. However, if reconverted before a register read, although EOCF is cleared the previous conversion result is retained until the next conversion is completed.
Page 167
2007-10-10
TMP91FU62
Example :After selecting the conversion time 19.5 s at 16 MHz and the analog input channel AIN3 pin, perform AD conversion once. After checking EOCF, read the converted value, store the lower 2 bits in address 0009EH nd store the upper 8 bits in address 0009FH in RAM. The operation mode is single mode.
LD LD (ADCCR1) , 00110011B (ADCCR2) , 00001100B ; Select AIN3 ;Select conversion time(312/fc) and operation mode
SET SLOOP : TEST JRS
(ADCCR1) . 7 (ADCCR2) . 7 T, SLOOP
; ADRS = 1(AD conversion start) ; EOCF= 1 ?
LD LD LD LD
A , (ADCDRL) (9EH) , A A , (ADCDRH) (9FH), A
; Read result data
; Read result data
9.4 IDLE1/STOP/SLOW Modes during AD Conversion
When standby mode (IDLE1,STOP or SLOW mode) is entered forcibly during AD conversion, the AD convert operation is suspended and the AD converter is initialized (ADCCR1 and ADCCR2 are initialized to initial value). Also, the conversion result is indeterminate. (Conversion results up to the previous operation are cleared, so be sure to read the conversion results before entering standby mode (IDLE1,STOP or SLOW mode).) When restored from standby mode (IDLE1,STOP or SLOW mode), AD conversion is not automatically restarted, so it is necessary to restart AD conversion. Note that since the analog reference voltage is automatically disconnected, there is no possibility of current flowing into the analog reference voltage. Moreover, in the case of the IDLE2 mode, it controls by the bit of ADCCR2.
Page 168
2007-10-10
TMP91FU62
9.5 Analog Input Voltage and AD Conversion Result
The analog input voltage is corresponded to the 10-bit digital value converted by the AD as shown in Figure 9-4.
3FFH 3FEH 3FDH AD conversion result 03H 02H 01H
0
1
2
3
1021 1022 1023 1024 Analog input voltage
1024
Figure 9-4 Analog Input Voltage and AD Conversion Result (Typ.)
Page 169
2007-10-10
TMP91FU62
9.6 Precautions about AD Converter
9.6.1 Analog input pin voltage range
Make sure the analog input pins (AN0 to AN15) are used at voltages within AVCC to AVSS. If any voltage outside this range is applied to one of the analog input pins, the converted value on that pin becomes uncertain. The other analog input pins also are affected by that.
9.6.2
Analog input shared pins
The analog input pins (AN0 to AN15) are shared with input/output ports. When using any of the analog inputs to execute AD conversion, do not execute input/output instructions for all other ports. This is necessary to prevent the accuracy of AD conversion from degrading. Not only these analog input shared pins, some other pins may also be affected by noise arising from input/output to and from adjacent pins.
9.6.3
Noise Countermeasure
The internal equivalent circuit of the analog input pins is shown in Figure 9-5. The higher the output impedance of the analog input source, more easily they are susceptible to noise. Therefore, make sure the output impedance of the signal source in your design is 5k or less. Toshiba also recommends attaching a capacitor external to the chip.
Internal resistance ANi Internal capacitance DA converter
Analog comparator
Permissible signal source impedance
Figure 9-5
Analog Input Equivalent Circuit and Example of Input Pin Processing
Page 170
2007-10-10
TMP91FU62
10. Program Patch Logic
The TMP91FU62 has a program patch logic, which enables the user to fix the program code in the on-chip ROM without generating a new mask. Patch program must be read into on-chip RAM from external memory during the startup routine. Up to six two-byte sequences, or banks (Twelve bytes in total) can be replaced with patch code. More significant code correction can be performed by replacing program code with single-byte instruction code which generates a software interrupt (SWI) to make a branch to a specified location in the on-chip RAM area.
The program patch logic only compares addresses in the on-chip ROM area; it cannot fix the program code in the on-chip peripheral, on-chip RAM and external ROM areas.
Each of six banks is independently programmable, and functionally equivalent. In the following sections, any references to bank0 also apply to other banks.
10.1 Block Diagram
Figure 10-1 Program Patch Logic Diagram
Page 171
2007-10-10
TMP91FU62
10.2 SFR Descriptions
The program patch logic consists of six banks (0 to 5). Each bank is provided with three bytes of address compare registers (ROMCMPx0 to ROMCMPx2) and two bytes of address substitution registers (ROMSUBxL and ROMSUBxH). Bank0 Address Compare Register 0
7 ROMCMP00 (0400H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank0 Address Compare Register 1
7 ROMCMP01 (0401H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank0 Address Compare Register 2
7 ROMCMP02 (0402H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank0 Data Substitution Register L
7 ROMSUB0L (0404H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank0 Data Substitution Register H
7 ROMSUB0H (0405H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP00/01/02, and ROMSUB0L/0H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 172
2007-10-10
TMP91FU62
Bank1 Address Compare Register 0
7 ROMCMP10 (0408H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank1 Address Compare Register 1
7 ROMCMP11 (0409H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank1 Address Compare Register 2
7 ROMCMP12 (040AH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank1 Data Substitution Register L
7 ROMSUB1L (040CH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank1 Data Substitution Register H
7 ROMSUB1H (040DH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP10/11/12, and ROMSUB1L/1H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 173
2007-10-10
TMP91FU62
Bank2 Address Compare Register 0
7 ROMCMP20 (0410H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank2 Address Compare Register 1
7 ROMCMP21 (0411H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank2 Address Compare Register 2
7 ROMCMP22 (0412H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank2 Data Substitution Register L
7 ROMSUB2L (0414H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank2 Data Substitution Register H
7 ROMSUB2H (0415H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP20/21/22, and ROMSUB2L/2H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 174
2007-10-10
TMP91FU62
Bank3 Address Compare Register 0
7 ROMCMP30 (0418H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank3 Address Compare Register 1
7 ROMCMP31 (0419H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank3 Address Compare Register 2
7 ROMCMP32 (041AH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank3 Data Substitution Register L
7 ROMSUB3L (041CH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank3 Data Substitution Register H
7 ROMSUB3H (041DH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP30/31/32, and ROMSUB3L/3H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 175
2007-10-10
TMP91FU62
Bank4 Address Compare Register 0
7 ROMCMP40 (0420H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank4 Address Compare Register 1
7 ROMCMP41 (0421H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank4 Address Compare Register 2
7 ROMCMP42 (0422H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank4 Data Substitution Register L
7 ROMSUB4L (0424H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank4 Data Substitution Register H
7 ROMSUB4H (0425H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP40/41/42, and ROMSUB4L/4H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 176
2007-10-10
TMP91FU62
Bank5 Address Compare Register 0
7 ROMCMP50 (0428H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 ROMC07 6 ROMC06 5 ROMC05 4 ROMC04 W 0 0 0 0 3 ROMC03 2 ROMC02 1 ROMC01 0
- - - -
Target ROM address (Lower 7 bits)
Bank5 Address Compare Register 1
7 ROMCMP51 (0429H) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC15 6 ROMC14 5 ROMC13 4 ROMC12 W 0 0 0 0 3 ROMC11 2 ROMC10 1 ROMC09 0 ROMC08
Target ROM address (Middle 8 bits)
Bank5 Address Compare Register 2
7 ROMCMP52 (042AH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMC23 6 ROMC22 5 ROMC21 4 ROMC20 W 0 0 0 0 3 ROMC19 2 ROMC18 1 ROMC17 0 ROMC16
Target ROM address (Upper 8 bits)
Bank5 Data Substitution Register L
7 ROMSUB5L (042CH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS07 6 ROMS06 5 ROMS05 4 ROMS04 W 0 0 0 0 3 ROMS03 2 ROMS02 1 ROMS01 0 ROMS00
Patch code (Lower 8 bits)
Bank5 Data Substitution Register H
7 ROMSUB5H (042DH) RMW instructions are prohibited. Bit symbol Read/Write After reset Function 0 0 0 0 ROMS15 6 ROMS14 5 ROMS13 4 ROMS12 W 0 0 0 0 3 ROMS11 2 ROMS10 1 ROMS09 0 ROMS08
Patch code (Upper 8 bits)
Note 1: The ROMCMP50/51/52, and ROMSUB5L/5H registers do not support read-modify-write operation. Note 2: Bit0 of the Address Compare Register 0 is read as undefined.
Page 177
2007-10-10
TMP91FU62
10.3 Operation
10.3.1 Replacing data
Two consecutive bytes of data can be replaced for each bank. A two-byte sequence to be replaced must start at an even address. If only a single byte at an even or odd address need be replaced, set the current masked ROM data in the other byte.
Correction procedure: Load the address compare registers (ROMCMP00 to ROMCMP02) with the target address where ROM data need be replaced. Store 2-byte patch code in the ROMSUB0L and ROMSUB0H registers. When the CPU address matches the value stored in the ROMCMP00 to ROMCMP02 registers, the program patch logic disables RD output to the masked ROM and drives out the code stored in the ROMSUB0L and ROMSUB0H to the internal bus. The CPU thus fetches the patch code.
The following shows some examples:
a. Replacing 00H at address FF1230H with AAH 7 ROMCMP00 ROMCMP01 ROMCMP02 ROMSUB0L ROMSUB0H 0 0 1 1 0 6 0 0 1 0 0 5 1 0 1 1 0 4 1 1 1 0 1 3 0 0 1 1 0 2 0 0 1 0 0 1 0 1 1 1 0 0 0 0 1 0 1 Stores 30 in address compare register 0 for bank0. Stores 12 in address compare register 1 for bank0. Stores FF in address compare register 2 for bank0. Store AA in address substitution register low for bank0. Store 11 in address substitution register high for bank0.
000000H 001000H
FE8000H
FF1230H FF1231H
00H 11H
Replace with AAH Replace with 11H (Same as current value).
FFFFFFH
Figure 10-2 Example Patch Code Implementation
Page 178
2007-10-10
TMP91FU62
b. Replacing 33H at address FF1233H with BBH 7 ROMCMP00 ROMCMP01 ROMCMP02 ROMSUB0L ROMSUB0H 0 0 1 0 1 6 0 0 1 0 0 5 1 0 1 1 1 4 1 1 1 0 1 3 0 0 1 0 1 2 0 0 1 0 0 1 1 1 1 1 1 0 0 0 1 0 1 Stores 32 in address compare register 0 for bank0. Stores 12 in address compare register 1 for bank0. Stores FF in address compare register 2 for bank0. Store 22 in address substitution register low for bank0. Store BB in address substitution register high for bank0.
000000H 001000H
FE8000H
FF1232H FF1233H
00H 11H
Replace with 22H (Same as current value). Replace with BBH
FFFFFFH
Figure 10-3 Example Patch Code Implementation
c. Replacing 44H at address FF1234H with CCH and 55H at address FF1235H with DDH 7 ROMCMP00 ROMCMP01 ROMCMP02 ROMSUB0L ROMSUB0H 0 0 1 1 1 6 0 0 1 1 1 5 1 0 1 0 0 4 1 1 1 0 1 3 0 0 1 1 1 2 1 0 1 1 1 1 0 1 1 0 0 0 0 0 1 0 1 Stores 34 in address compare register 0 for bank0. Stores 12 in address compare register 1 for bank0. Stores FF in address compare register 2 for bank0. Store CC in address substitution register low for bank0. Store DD in address substitution register high for bank0.
000000H 001000H
FE8000H
FF1234H FF1235H
00H 11H
Replace with CCH Replace with DDH
FFFFFFH
Figure 10-4 Example Patch Code Implementation
Page 179
2007-10-10
TMP91FU62
d. Replacing 77H at address FF1237H with EEH and 88H at address FF1238H with FFH (Requiring two banks) 7 ROMCMP00 ROMCMP01 ROMCMP02 ROMSUB0L ROMSUB0H ROMCMP10 ROMCMP11 ROMCMP12 ROMSUB1L ROMSUB1H 0 0 1 0 1 0 0 1 1 1 6 0 0 1 1 1 0 0 1 1 0 5 1 0 1 1 1 1 0 1 1 0 4 1 1 1 0 0 1 1 1 1 1 3 0 0 1 0 1 1 0 1 1 1 2 1 0 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 Stores 36 in address compare register 0 for bank0. Stores 12 in address compare register 1 for bank0. Stores FF in address compare register 2 for bank0. Store 66 in address substitution register low for bank0. Store EE in address substitution register high for bank0. Stores 38 in address compare register 0 for bank1. Stores 12 in address compare register 1 for bank1. Stores FF in address compare register 2 for bank1. Store FF in address substitution register low for bank1. Store 99 in address substitution register high for bank1.
000000H 001000H
FE8000H
FF1236H FF1237H FF1238H FF1239H
66H 77H 88H 99H
Replace with 66H (Same as current value). Replace with EEH Replace with FFH Replace with 99H (Same as current value).
FFFFFFH
Figure 10-5 Example Patch Code Implementation
Page 180
2007-10-10
TMP91FU62
10.3.2 Using an interrupt to cause a branch
A wider range of program code can also be fixed using a software interrupt (SWI). With a patch code loaded into on-chip RAM, the program patch logic can be used to replace program code at a specified address with a single-byte SWI instruction, which causes a branch to the patch program. Note that this method can only be used if the original masked ROM has been developed with on-chip RAM addresses specified as SWI vector addresses.
Correction procedure: Load the address compare registers (ROMCMP00 to ROMCMP02) with the start address of the program code that is to be fixed. If it is an even address, store an SWI instruction code (e.g., SWI:F9H) in the ROMSUBL. If the start address is an odd address, store an SWI instruction code in the ROMSUBH and the current ROM data at the preceding even address in the ROMSUBL. When the CPU address matches the value stored in the ROMCMP00 to ROMCMP02 registers, the program patch logic disables RD output to the masked ROM and drives out the SWI instruction code to the internal bus. Upon fetching the SWI code, the CPU makes a branch to the internal RAM area to execute the preloaded code. At the end of the patch program executed from the internal RAM, the CPU directly rewrites the saved PC value so that it points to the address following the patch code, and then executes a RETI.
The following shows an example:
Example: Fixing a program within the range from FF5000H to FF507FH Before developing the original masked ROM, set the SWI1 vector reference address to 001500H (onchip RAM area). Use the startup routine to load the patch code to on-chip RAM (001500H to 0015EFH). Store the start address (FF5000H) of the ROM area to be fixed in the ROMCMP00 to ROMCMP02. Store the SWI1 instruction code (F9H) in the ROMSUB0L and the current data at FF5001H (AAH) in the ROMSUB0H. When the CPU address matches the value stored in ROMCMP00 to ROMCMP02, the program patch logic replaces the ROM-based code at FF5000H with F9H. The CPU then executes the SWI1 instruction, which causes a branch to 001500H in the on-chip RAM area. After executing the patch program the CPU finally rewrites the saved PC value to FF5080H and executes a RETI.
Page 181
2007-10-10
TMP91FU62
RETI
55H AAH
Replace the start address with F9H (SWI1 instruction code). Replace with AAH (Same as current value).
001500H
SW1
Figure 10-6 Example ROM Correction
Page 182
2007-10-10
TMP91FU62
11. Watchdog Timer (Runaway detection timer)
The TMP91FU62 features a watchdog timer for detecting runaway. The watchdog timer (WDT) is used to return the CPU to normal state when it detects that the CPU has started to malfunction (Runaway) due to causes such as noise. When the watchdog timer detects a malfunction, it generates a non-maskable interrupt INTWD to notify the CPU. Connecting the watchdog timer output to the reset pin internally forces a reset.(The level of external RESET pin is not changed)
11.1 Configuration
Figure 11-1 is a block diagram of he watchdog timer (WDT).
WDMOD
RESET Internal reset
Reset control
INTWD interrupt reguest WDMOD Selector 215 217 219 221 fSYS (fFPH/2) Binary counter (22 stages) Reset Q R S
Internal reset Write 4EH Write B1H WDMOD
WDT control register WDCR
Internal data bus
Figure 11-1 Block Diagram of Watchdog Timer
Note: It needs to care designing the total machine set, because watchdog timer can't operate completely by external noise.
Page 183
2007-10-10
TMP91FU62
11.2 Operation
The watchdog timer generates an INTWD interrupt when the detection time set in the WDMOD has elapsed. The watchdog timer must be cleared "0" by software before an INTWD interrupt will be generated. If the CPU malfunctions (e.g., if runaway occurs) due to causes such as noise, but does not execute the instruction used to clear the binary counter, the binary counter will overflow and an INTWD interrupt will be generated. The CPU will detect malfunction (Runaway) due to the INTWD interrupt and in this case it is possible to return to the CPU to normal operation by means of an anti-malfunction program. The watchdog timer works immediately after reset. The watchdog timer does not operate in IDLE1 or STOP mode. When the device is in IDLE2 mode, the operation of WDT depends on the WDMOD setting. Ensure that WDMOD is set before the device enters IDLE2 mode. The watchdog timer consists of a 22-stage binary counter which uses the system clock (fSYS) as the input clock. The binary counter can output fSYS/215, fSYS/217, fSYS/219 and fSYS/221.
WDT counter WDT interrupt
n
Overflow
0
Write clear code
WDT clear (Software)
Figure 11-2 Normal Mode
The runaway is detected when an overflow occurs, and the watchdog timer can reset this device. In this case, the reset time will be between 22 and 29 states (51.2 s at fOSCH = 20 MHz) as shown in Figure 11-3. After a reset, the fSYS clock (1 cycle = 1 state) is fFPH/2, where fFPH is generated by dividing the high-speed oscillator clock (fOSCH) by sixteen through the clock gear function.
Overflow WDT counter WDT interrupt n
Internal reset 22 to 29 states s at fOSCH = 27 MHz, fFPH = 1.7 MHz)
(26.1 to 34.4
Figure 11-3 Reset Mode
Page 184
2007-10-10
TMP91FU62
11.3 Control Registers
The watchdog timer WDT is controlled by two control registers WDMOD and WDCR.
11.3.1 Watchdog timer mode register (WDMOD)
a. Setting the detection time for the watchdog timer in This 2-bit register is used for setting the watchdog timer interrupt time used when detecting runaway. After reset, this register is initialized to WDMOD = "00"(215/ fSYS [S]). b. Watchdog timer enable/disable control register After reset, WDMOD is initialized to "1", enabling the watchdog timer. To disable the watchdog timer, it is necessary to set this bit to "0" and to write the disable code (B1H) to the watchdog timer control register WDCR. This makes it difficult for the watchdog timer to be disabled by runaway. However, it is possible to return the watchdog timer from the disabled state to the enabled state merely by setting to "1". c. Watchdog timer out reset connection This register is used to connect the output of the watchdog timer with the internal RESET. Since WDMOD is initialized to "0" on reset, a reset by the watchdog timer will not be performed.
11.3.2 Watchdog timer control register (WDCR)
This register is used to disable and clear the binary counter for the watchdog timer. * Disable control The watchdog timer can be disabled by clearing WDMOD to "0" and then writing the disable code (B1H) to the WDCR register.
WDMOD WDCR 0 1 - 0 - 1 X 1 X 0 - 0 - 0 0 1 Clear WDMOD to "0". Write the disable code (B1H).
* Enable control Set WDMOD to "1". * Watchdog timer clear control To clear the binary counter and cause counting to resume, write the clear code (4EH) to the WDCR register.
WDCR 0 1 0 0 1 1 1 0 Write the clear code (4EH).
Page 185
2007-10-10
TMP91FU62
Watchdog Timer Mode Register
7 Bit symbol WDMOD (0300H) Read/Write After reset WDTE R/W 1 0 Select detecting time 00: 215/fSYS Function WDT control 1: Enable 01: 217/fSYS 10: 219/fSYS 11: 221/fSYS IDLE2 control Reset control Always write "0". 6 WDTP1 R/W 0 5 WDTP0 4 - - - 3 - - - 0 2 I2WDT R/W 0 1 RESCR 0 - R/W 0
Watchdog timer out control
0 RESCR 1 Connect WDT out to a internal reset -
IDLE2 control
0 I2WDT 1 Operation Stop
Watchdog timer detection time
SYSCR1 System Clock Selection 1(fs) SYSCR1 Gear Value xxx 000 (fc) 001 (fc/2) 0(fc) 010(fc/4) 011 (fc/8) 100 (fc/16)
@fc = 20 MHz, fs = 32.768 kHz
Watchdog Timer Detection Time WDMOD 00 2.0 s 3.28 ms 6.55 ms 13.11 ms 26.21 ms 52.43 ms 01 8.0 s 13.11 ms 26.21 ms 52.43 ms 104.86 ms 209.72 ms 10 32.0 s 52.43 ms 104.86 ms 209.72 ms 419.43 ms 838.86 ms 11 128.0 s 209.72 ms 419.43 ms 838.86 ms 1677.72 ms 3355.44 ms
Watchdog timer enable/disable control
0 WDTE 1 Enabled Disabled
Watchdog Timer Control Register
7 WDCR (0301H) RMW instructions are prohibited. Bit symbol Read/Write 6 5 4 W 3 2 1 0
After reset
-
Function
B1H: WDT disable code 4EH: WDT clear code
Disable/clear WDT
B1H 4EH Others Disable code Clear code Don't care
Page 186
2007-10-10
TMP91FU62
12. Special timer for CLOCK
The TMP91FU62 includes a timer that is used for a clock operation. An interrupt (INTRTC) can be generated each 0.0625 [s] or 0.125 [s] or 0.25 [s] or 0.50 [s] by using a low frequency clock of 32.768 kHz. A clock function can be easily used. In addition, INTRTC can return from each standby mode except STOP mode. A special timer for CLOCK can operate in all modes in which a low-frequency oscillation is operated. The special timer for CLOCK is controlled by the special timer for CLOCK control register (RTCCR) as shown in.
12.1 Configuration
RTCCR RTCCR Run/ Clear fs (32.768 kHz)
Selector
Interrupt request INTRTC
211 212 213 214
14-stage binary counter
Figure 12-1 Block Diagram for Special Timer for CLOCK
Special Timer for CLOCK Control Register
7 RTCCR (0310H) Bit symbol Read/Write After reset 6 5 4 3 2 RTCSEL1 R/W 0 00: Function Always write "0". 214/fs
12
1 RTCSEL0
0 RTCRUN R/W
-
R/W 0
- - -
- - -
- - -
- - -
0
0 0: Stop & clear 1: Count
-
-
-
-
01: 213/fs 10: 2 /fs 11: 211/fs
Counting operation
0 1 Count Stop & clear
Interrupt generation cycle (fs = 32.768 kHz)
00 11 10 11 0.125 s 0.0625 s 0.50 s 0.25 s
Page 187
2007-10-10
TMP91FU62
13. Flash Memory
The TMP91FU62 incorporates flash memory that can be electrically erased and programmed using a single 5V power supply. The flash memory is programmed and erased using JEDEC-standard commands. After a program or erase command is input, the corresponding operation is automatically performed internally. Erase operations can be performed by the entire chip (chip erase) or on a sector basis (sector erase). The configuration and operations of the flash memory are described below.
13.1 Features
Power supply voltage for program/erase operations - Vcc = 4.75 to 5.25 V (TOPR = -10 to 40 C, fc = 4 to 20MHz) Configuration - 48K x 16 bits (96 k bytes) Functions - Single-word programming - Chip erase - Sector erase - Data polling / Toggle bit Sector size - 8Kbytes x 12 Mode control - JEDEC-standard commands Programming method - On-board programming - Parallel programmer Security - Write protection - Read protection
13.2 Block Diagram
Figure 13-1 Block Diagram of Flash Memory Unit
Page 188
2007-10-10
TMP91FU62
13.3 Operation Modes
13.3.1 Overview
The following three types of operation modes are available to control program/erase operations on the flash memory. Table 13-1 Description of Operation Modes
Operation Mode Name Description After reset release, the device starts up from the internal flash memory. Single Chip mode is further divided into two modes: "Normal mode" is a mode in which user application programs are executed, and "User Boot mode" is used to program the flash memory on-board. The means of switching between these two modes can be set by the user as desired. For example, it can be set so that Port 00 = '1' selects Normal mode and Port 00 = '0' selects User Boot mode. The user must include a routine to handle mode switching in a user application program. In this mode, the device starts up from a user application program. In this mode, the flash memory can be programmed by a user-specified method. After reset release, the device starts up from the internal boot ROM (mask ROM). The boot ROM includes an algorithm which allows a program for programming/erasing the flash memory on-board via a serial port to be transferred to the device's internal RAM. The transferred program is then executed in the internal RAM so that the flash memory can be programmed/erased by receiving data from an external host and issuing program/erase commands. This mode enables the internal flash memory to be programmed/erased using a general-purpose programmer. For programmers that can be used, please contact your local Toshiba sales representative.
Single Chip mode
Normal mode User Boot mode
Single Boot mode
Programmer mode
Of the modes listed in Table 13-1, the internal flash memory can be programmed in User Boot mode, Single Boot mode and Programmer mode.
The mode in which the flash memory can be programmed/erased while mounted on the user board is defined as the on-board programming mode. Of the modes listed above, Single Boot mode and User Boot mode are classified as on-board programming modes. Single Boot mode supports Toshiba's proprietary programming/ erase method using serial I/O. User Boot mode (within Single Chip mode) allows the flash memory to be programmed/erased by a user-specified method.
Programmer mode is provided with a read protect function which prohibits reading of ROM data. By enabling the read protect function upon completion of programming, the user can protect ROM data from being read by third parties.
Page 189
2007-10-10
TMP91FU62
The operation mode Single Chip mode, Single Boot mode or Programmer mode is determined during reset by externally setting the input levels on the AM0, AM1 and BOOT (EMU0) pins.
Except in Programmer mode which is entered with RESET held at "0", the CPU will start operating in the selected mode after the reset state is released. Once the operation mode has been set, make sure that the input levels on the mode setting pins are not changed during operation.Table 13-2 shows how to set each operation mode, and Figure 13-2 shows a mode transition diagram. Table 13-2 Operation Mode Pin Settings
Input pins Operation Mode
RESET
AM1 1
AM0 1 1 0
(1) (2) (3)
Single Chip mode (Normal or User Boot mode) rising edge Single Boot mode Programmer mode 0
0 1
Note: Numbers in ( ) correspond to the operation mode pin settings shown in Table 13-2.
Figure 13-2 Mode Transition Diagram
13.3.2 Reset Operation
To reset the device, hold the RESET input at "0" for at least 10 system clocks while the power supply voltage is within the rated operating voltage range and the internal high-frequency oscillator is oscillating stably. For details, refer to "Reset of CPU".
Page 190
2007-10-10
TMP91FU62
13.3.3 Memory Map for Each Operation Mode
In this product, the memory map varies with operation mode. The memory map and sector address ranges for each operation mode are shown below.
External memory (Access prohibited)
External memory (Access prohibited)
External memory (Access prohibited)
Figure 13-3 Memory Map for Each Operation Mode
Page 191
2007-10-10
TMP91FU62
Table 13-3 Sector Address Ranges for Each Operation Mode
Single Chip Mode Sector-0 Sector-1 Sector-2 Sector-3 Sector-4 Sector-5 Sector-6 Sector-7 Sector-8 Sector-9 Sector-10 Sector-11 FE8000H to FE9FFFH FEA000H to FEBFFFH FEC000H to FEDFFFH FEE000H to FEFFFFH FF0000H to FF1FFFH FF2000H to FF3FFFH FF4000H to FF5FFFH FF6000H to FF7FFFH FF8000H to FF9FFFH FFA000H to FFBFFFH FFC000H to FFDFFFH FFE000H to FFFFFFH Single Boot Mode 10000H to 11FFFH 12000H to 13FFFH 14000H to 15FFFH 16000H to 17FFFH 18000H to 19FFFH 1A000H to 1BFFFH 1C000H to 1DFFFH 1E000H to 1FFFFH 20000H to 21FFFH 22000H to 23FFFH 24000H to 25FFFH 26000H to 27FFFH
Page 192
2007-10-10
TMP91FU62
13.4 Single Boot Mode
In Single Boot mode, the internal boot ROM (mask ROM) is activated to transfer a program/erase routine (usercreated boot program) from an external source into the internal RAM. This program/erase routine is then used to program/erase the flash memory. In this mode, the internal boot ROM is mapped into an area containing the interrupt vector table, in which the boot ROM program is executed. The flash memory is mapped into an address space different from the one into which the boot ROM is mapped (See Figure 13-3). The device's SIO (SIO1) and the controller are connected to transfer the program/erase routine from the controller to the device's internal RAM. This program/erase routine is then executed to program/erase the flash memory. The program/erase routine is executed by sending commands and write data from the controller. The communications protocol between the device and the controller is described later in this manual. Before the program/erase routine can be transferred to the RAM, user password verification is performed to ensure the security of user ROM data. If the password is not verified correctly, the RAM transfer operation cannot be performed. In Single Boot mode, disable interrupts and use the interrupt request flags to check for an interrupt request.
Note: Do not change to another operation mode in the program/erase routine.
Page 193
2007-10-10
TMP91FU62
13.4.1 Using the program/erase algorithm in the internal boot ROM
(Step-1)Environment setup Since the program/erase routine and write data are transferred via SIO (SIO1), connect the device's SIO (SIO1) and the controller on the board. The user must prepare the program/erase routine (a) on the controller.
(Step-2) Starting up the internal boot ROM Release the reset with the relevant input pins set for entering Single Boot mode. When the internal boot ROM starts up, the program/erase routine (a) is transferred from the controller to the internal RAM via SIO according to the communications procedure for Single Boot mode. Before this can be carried out, the password entered by the user is verified against the password written in the user application program. (If the flash memory has been erased, 12 bytes of "0xFF" are used as the password.)
Page 194
2007-10-10
TMP91FU62
(Step-3) Copying the program/erase routine to the RAM After password verification is completed, the boot ROM copies the program/erase routine (a) from the controller to the RAM using serial communications. The program/erase routine must be stored within the RAM address range of 001000H to 001DFFH.
(Step-4) Executing the program/erase routine in the RAM Control jumps to the program/erase routine (a) in the RAM. If necessary, the old user application program is erased (sector erase or chip erase).
Note 1: The boot ROM is provided with an erase command, which enables the entire chip to be erased from the controller without using the program/erase routine. Note 2: If it is necessary to erase data on a sector basis, incorporate the necessary code in the program/erase routine.
Page 195
2007-10-10
TMP91FU62
(Step-5) Copying the new user application program The program/erase routine (a) loads the new user application program from the controller into the erased area of the flash memory. In the example below, the new user application program is transferred under the same communications conditions as those used for transferring the program/erase routine. However, after the program/erase routine has been transferred, this routine can be used to change the transfer settings (data bus and transfer source). Configure the board hardware and program/erase routine as desired.
(Step-6) Executing the new user application program After the programming operation has been completed, turn off the power to the board and remove the cable connecting the device and the controller. Then, turn on the power again and start up the device in Single Chip mode to execute the new user application program.
Page 196
2007-10-10
TMP91FU62
13.4.2 Connection Examples for Single Boot Mode
In Single Boot mode the flash memory is programmed by serial transfer. Therefore, on-board programming is performed by connecting the device's SIO (SIO1) and the controller (programming tool) and sending commands from the controller to the device. Figure 13-4 shows an example of connection between the target board and a programming controller. Figure 13-5 shows an example of connection between the target board and an RS232C board.
Figure 13-4 Example of Connection with an External Controller in Single Boot Mode
Page 197
2007-10-10
TMP91FU62
Figure 13-5 Example of Connection with an RS232C Board in Single Boot Mode
Page 198
2007-10-10
TMP91FU62
13.4.3 Mode Setting
To perform on-board programming, the device must be started up in Single Boot mode by setting the input pins as shown below. AM0 = 1 AM1 = 0 RESET= 0 1 Set the AM0 and AM1 pins as shown above with the RESET pin held at "0". Then, setting the RESET pin to "1" will start up the device in Single Boot mode.
13.4.4 Memory Maps
Figure 13-6 shows a comparison of the memory map for Normal mode (in Single Chip mode) and the memory map for Single Boot mode. In Single Boot mode, the flash memory is mapped to addresses 10000H to 27FFFH (physical addresses) and the boot ROM (mask ROM) is mapped to addresses FFF000H to FFFFFFH.
000000H 001000H
Internal I/O Internal RAM 4KB
000000H 001000H
Internal I/O Internal RAM 4KB
002000H
002000H
External memory (Access prohibited)
010000H External memory (Access prohibited)
(
)
Internal Flash ROM 96 ROM Flash KB
028000H
FE8000H
External memory (Access prohibited)
Internal Flash ROM 96 KB FFFF00H FFFFFFH
(Interrupt vector 256B)
FFF000H FFFF00H FFFFFFH
Internal Boot ROM 4KB
(Interrupt vector 256B)
Figure 13-6 Comparison of Memory Maps
Page 199
2007-10-10
TMP91FU62
13.4.5 Interface Specifications
The SIO communications format in Single Boot mode is shown below. The device supports the UART (asynchronous communications) serial operation mode. To perform on-board programming, the same communications format must also be set on the programming controller's side.
UART (asynchronous) communications
- Communications channel - Serial transfer mode - Data length - Parity bit - STOP bit - Baud rate
: SIO channel 1(For the pins be used, see Table 13-4) : UART (asynchronous communications) mode : 8 bits : None : 1 bit : See Table 13-5, Table 13-6
Table 13-4 Pin Connections
Pins Power supply pins Mode setting pins Reset pin Communications pins DVCC DVSS AM1,AM0 RESET TXD1 RXD1 UART

Note: Unused pins are in the initial state after reset release.
Table 13-5 Baud Rate Table
SIO UART 115200 57600 Transfer Rate (bps) 38400 19200 9600
Page 200
2007-10-10
TMP91FU62
Table 13-6 Correspondence between Operating Frequency and Baud Rate in Single Boot Mode
Error (%) 0 20 19.37 to 20.05 9766 +1.73 19531 +1.73 39063 +1.73 -
115200
Baud Rate (bps)
115200
-
-
-
-
-
Error (%)
0
57600
Baud Rate (bps)
57600
+1.73
Error (%)
0
0
-
-
-
38400
Baud Rate (bps)
39063
38400
38400
-
-
-
+1.73
+0.16
Error (%)
0
0
0
19200
Baud Rate (bps)
19531
19200
19200
19200
19231
+0.16
+1.73
+0.16
Error (%)
0
0
0
9600
Baud Rate (bps)
9615
9766
9600
9600
9600
9615
14.53 to 15.04
15.74 to 16.29
Reference Baud Rate (bps)
Reference Frequency (MHz)
14.7456
Reference frequency:
The frequency of the high-speed oscillation circuit that can be used in Single Boot mode. To program the flash memory using Single Boot mode, one of the reference frequencies must be selected as a high-speed clock. Supported Range: The range of clock frequencies that are detected as each reference frequency. It may not be possible to perform Single Boot operations at clock frequencies outside of the supported range.
Note:To automatically detect the reference frequency (microcontroller clock frequency), the transfer baud rate error of the flash memory programming controller and the oscillation frequency error must be within -1.5%, +2% in total.
18.4320
11.0592
12.288
10
16
8
18.16 to 18.80
10.90 to 11.28
12.11 to 12.53
9.69 to 10.02
7.87 to 8.14
Supported Range (MHz)
9600
0
19200
-
0
-
-
-
57600
-
-
-
-
-
0
-
-
-
-
-
-
Page 201
2007-10-10
TMP91FU62
13.4.6 Data Transfer Formats
Table 13-7 to Table 13-12 show the operation command data and the data transfer format for each operation mode. Table 13-7 Operation Command Data
Operation Command Data
10H 20H 30H 40H 60H
Operation Mode
RAM Transfer Flash Memory SUM Product Information Read Flash Memory Chip Erase Flash Memory Protect Set
Page 202
2007-10-10
TMP91FU62
Table 13-8 Transfer Format of Single Boot Program [RAM Transfer]
Transfer Byte Number Transfer Data from Controller to Device Baud rate setting UART 86H Baud Rate Desired baud rate#1
Transfer Data from Device to Controller
ACK response to baud rate setting Normal (baud rate OK) >UART 86H (If the desired baud rate cannot be set, operation is terminated.)
BOOT ROM
1st byte
2nd byte
-
3rd byte
Operation command data
(10H)
ACK response to operation command#2 Normal 10H Error x1H Protection applied#3 Communications error x6H x8H
4th byte
-
5th byte to 16th byte 17th byte
PASSWORD data (12 bytes) (027EF4H to 027EFFH) CHECKSUM value for 5th to 16th bytes ACK response to CHECKSUM value#2
18th byte
-
Normal Error Communications error -
10H 11H 18H
19th byte 20th byte 21th byte 22th byte 23th byte 24th byte 25th byte
RAM storage start address 31 to 24 #4 RAM storage start address 23 to 16#4 RAM storage start address 15 to 8#4 RAM storage start address 7 to 0#4 RAM storage byte count 15 to 8#4 RAM storage byte count 7 to 0#4
CHECKSUM value for 19th to 24th bytes #4
26th byte
-
ACK response to CHECKSUM value#2 Normal 10H Error 11H Communications error 18H
27th byte to (m)th byte (m+1)th byte
RAM storage data
-
CHECKSUM value for 27th to m'th bytes
ACK response to CHECKSUM value#2 Normal 10H Error 11H Communications error 18H JUMP to RAM storage start address
(m+2)th byte
-
RAM #1 #2 #3 #4
(m+3)th byte
-
For the desired baud rate setting, see Table 13-6. After sending an error response, the device waits for operation command data (3rd byte). When read protection or write protection is applied, the device aborts the received operation command and waits for the next operation command data (3rd byte). The data to be transferred in the 19th to 25th bytes should be programmed within the RAM address range of 001000H to 001DFFH (3.5 Kbytes).
Page 203
2007-10-10
TMP91FU62
Table 13-9 Transfer Format of Single Boot Program [Flash Memory SUM]
Transfer Byte Number Transfer Data from Controller to Device Baud rate setting UART 86H Baud Rate Desired baud rate#1
Transfer Data from Device to Controller
ACK response to baud rate setting Normal (baud rate OK) >UART 86H (If the desired baud rate cannot be set, operation is terminated.)
BOOT ROM
1st byte
2nd byte
-
3rd byte
Operation command data
(20H)
ACK response to CHECKSUM value#2 Normal 20H Error x1H Communications error x8H SUM (upper) SUM (lower) CHECKSUM value for 5th and 6th bytes -
4th byte
-
5th byte 6th byte 7th byte 8th byte #1 #2
(Wait for the next operation command data)
For the desired baud rate setting, see Table 13-6. After sending an error response, the device waits for operation command data (3rd byte).
Page 204
2007-10-10
TMP91FU62
Table 13-10 Transfer Format of Single Boot Program [Product Information Read](1/2)
Transfer Byte Number Transfer Data from Controller to Device Baud rate setting UART 86H Baud Rate Desired baud rate#1
Transfer Data from Device to Controller
ACK response to baud rate setting Normal (baud rate OK) >UART 86H (If the desired baud rate cannot be set, operation is terminated.)
BOOT ROM
1st byte
2nd byte
-
3rd byte
Operation command data
(30H)
ACK response to operation command#2 Normal 30H Error x1H Communications x8H Flash memory data (address 027EF0H) Flash memory data (address 027EF1H) Flash memory data (address 027EF2H) Flash memory data (address 027EF3H) Part number (ASCII code, 12 bytes) 'TMP91FU62_ _ _ ' (from 9th byte) Password comparison start address (4 bytes) F4H, 7EH, 02H, 00H (from 21st byte) RAM start address (4 bytes) 00H, 10H, 00H, 00H (from 25th byte)
4th byte
-
5th byte 6th byte 7th byte 8th byte 9th byte to 20th byte 21th byte to 24th byte 25th byte to 28th byte 29th byte to 32th byte 33th byte to 36th byte 37th byte to 40th byte 41th byte to 44th byte
-
-
-
-
-
RAM (user area) end address (4 bytes) FFH, 1DH, 00H, 00H (from 29th byte)
-
RAM end address (4 bytes) FFH, 1FH, 00H, 00H (from 33rd byte)
-
Dummy data (4 bytes) 00H,00H,00H,00H (from 37th byte)
-
Dummy data (4 bytes) 00H, 00H, 00H, 00H (from 41st byte) FUSE information (2 bytes from 45th byte) Read protection/Write protection 1) Applied/Applied : 00H, 00H 2) Not applied/Applied : 01H, 00H 3) Applied/Not applied : 02H, 00H 4) Not applied/Not applied : 03H, 00H Flash memory start address (4 bytes) 00H, 00H, 01H, 00H (from 47th byte)
45th byte to 46th byte
-
47th byte to 50th byte 51th byte to 54th byte 55th byte to 56th byte 57th byte to 60th byte
-
-
Flash memory end address (4 bytes) FFH, 7FH, 02H, 00H (from 51st byte) Number of sectors in flash memory (2 bytes) 0CH, 00H (from 55th byte) Start address of flash memory sectors of the same size (4 bytes) 00H, 00H, 01H, 00H (from 57th byte)
-
-
Page 205
2007-10-10
TMP91FU62
Table 13-10 Transfer Format of Single Boot Program [Product Information Read](2/2)
Transfer Byte Number 61th byte to 64th byte Transfer Data from Controller to Device Baud Rate
Transfer Data from Device to Controller
Size (in half words) of flash memory sectors of the same size (4 bytes) 00H, 10H, 00H, 00H (from 61st byte) Number of flash memory sectors of the same size (1 byte) 0CH CHECKSUM value for 5th to 65th bytes -
-
65th byte
-
66th byte 67th byte #1 #2
(Wait for the next operation command data)
For the desired baud rate setting, see Table 13-6. After sending an error response, the device waits for operation command data (3rd byte).
Table 13-11 Transfer Format of Single Boot Program [Flash Memory Chip Erase]
Transfer Byte Number Transfer Data from Controller to Device Baud rate setting UART 86H Baud Rate Desired baud rate#1
Transfer Data from Device to Controller
ACK response to baud rate setting Normal (baud rate OK) >UART 86H (If the desired baud rate cannot be set, operation is terminated.)
BOOT ROM
1st byte
2nd byte
-
3rd byte
Operation command data
(40H)
ACK response to operation command#2 Normal 40H Error x1H Communications x8H
4th byte
-
5th byte
Erase Enable command data
(54H)
ACK response to operation command#2 Normal 54H Error x1H Communications x8H ACK response to Erase command Normal 4FH Error 4CH ACK response Normal Error -
6th byte
-
7th byte
-
8th byte
-
5DH 60H
9th byte #1 #2
(Wait for the next operation command data)
For the desired baud rate setting, see Table 13-6. After sending an error response, the device waits for operation command data (3rd byte).
Page 206
2007-10-10
TMP91FU62
Table 13-12 Transfer Format of Single Boot Program [Flash Memory Protect Set]
Transfer Byte Number Transfer Data from Controller to Device Baud rate setting UART 86H Baud Rate Desired baud rate#1
Transfer Data from Device to Controller
ACK response to baud rate setting Normal (baud rate OK) >UART 86H (If the desired baud rate cannot be set, operation is terminated.)
BOOT ROM
1st byte
2nd byte
-
3rd byte
Operation command data
(60H)
ACK response to operation command#2 Normal 60H Error x1H Communications x8H
4th byte
-
5th byte to 16th byte 17th byte
Password data (12 bytes) (027EF4H to 027EFFH) CHECKSUM value for 5th to 16th bytes ACK response to checksum value#2 Normal 60H Error 61H Communications 68H ACK response to Protect Set command Normal 6FH Error 6CH ACK response Normal Error -
18th byte
-
19th byte
-
20th byte
-
31H 34H
21th byte
(Wait for the next operation command data)
#1 #2
For the desired baud rate setting, see Table 13-6. After sending an error response, the device waits for operation command data (3rd byte).
Page 207
2007-10-10
TMP91FU62
13.4.7 Boot Program
When the device starts up in Single Boot mode, the boot program is activated. The following explains the commands that are used in the boot program to communicate with the controller when the device starts up in Single Boot mode. Use this information for creating a controller for using Single Boot mode or for building a user boot environment. 1. RAM Transfer command In RAM transfer, data is transferred from the controller and stored in the device's internal RAM. When the transfer completes normally, the boot program will start running the transferred user program. Up to 3.5 Kbytes of data can be transferred as a user program. (This limit is implemented in the boot program to protect the stack pointer area.) The user program starts executing from the RAM storage start address. This RAM transfer function enables a user-created program/erase routine to be executed, allowing the user to implement their own on-board programming method. To perform on-board programming with a user program, the flash memory command sequences (see section 13.6) must be used. After the RAM Transfer command has been completed, the entire internal RAM area can be used. If read protection or write protection is applied on the device or a password error occurs, this command will not be executed. 2. Flash Memory SUM command This command calculates the SUM of 96 Kbytes of data in the flash memory and returns the result. There is no operation command available to the boot program for reading data from the entire area of the flash memory. Instead, this Flash Memory SUM command can be used. Reading the SUM value enables revision management of the application program. 3. Product Information Read command This command returns the information about the device including its part number and memory details stored in the flash memory at addresses 027EF0H to 027EF3H. This command can also be used for revision management of the application program. 4. Flash Memory Chip Erase command This command erases all the sectors in the flash memory. If read protection or write protection is applied on the device, all the sectors in the flash memory are erased and the read protection or write protection is cleared. Since this command is also used to restore the operation of the boot program when the password is forgotten, it does not include password verification. 5. Flash Memory Protect Set command This command sets both read protection and write protection on the device. However, if a password error occurs, this command will not be executed. When read protection is set, the flash memory cannot be read in Programmer mode. When write protection is set, the flash memory cannot be written in Programmer mode.
Page 208
2007-10-10
TMP91FU62
13.4.8 RAM Transfer Command
See Table 13-8. 1. From the controller to the device The data in the 1st byte is used to determine the baud rate. The 1st byte is transferred with receive operation disabled (SC1MOD0 = 0). (The baud rate is determined using an internal timer.) To communicate in UART mode Send the value 86H from the controller to the target board using UART settings at the desired baud rate. If the serial operation mode is determined as UART, the device checks to see whether or not the desired baud rate can be set. If the device determines that the desired baud rate cannot be set, operation is terminated and no communications can be established. 2. From the device to the controller The data in the 2nd byte is the ACK response returned by the device for the serial operation mode setting data sent in the 1st byte. If the data in the 1st byte is found to signify UART and the desired baud rate can be set, the device returns 86H. Baud rate determination The device determines whether or not the desired baud rate can be set. If it is found that the baud rate can be set, the boot program rewrites the BR1CR and BR1ADD values and returns 86H. If it is found that the desired baud rate cannot be set, operation is terminated and no data is returned. The controller sets a time-out time (5 seconds) after it has finished sending the 1st byte. If the controller does not receive the response (86H) normally within the time-out time, it should be considered that the device is unable to communicate. Receive operation is enabled (SC1MOD0 = 1) before 86H is written to the transmission buffer. 3. From the controller to the device The data in the 3rd byte is operation command data. In this case, the RAM Transfer command data (10H) is sent from the controller to the device. 4. From the device to the controller The data in the 4th byte is the ACK response to the operation command data in the 3rd byte. First, the device checks to see if the received data in the 3rd byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined (They are the upper four bits of the immediately preceding operation command data). Next, if the data received in the 3rd byte corresponds to one of the operation commands given in Table 13-7, the device echoes back the received data (ACK response for normal reception). In the case of the RAM Transfer command, if read or write protection is not applied, 10H is echoed back and then execution branches to the RAM transfer processing routine. If protection is applied, the device returns the corresponding ACK response data (bit 2/1) x6H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) After branching to the RAM transfer processing routine, the device checks the data in the password area. For details, see " 13.4.15 Password ". If the data in the 3rd byte does not correspond to any operation command, the device returns the ACK response data for operation command error (bit0) x1H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.)
Page 209
2007-10-10
TMP91FU62
5. From the controller to the device The 5th to 16th bytes contain password data (12 bytes). The data in the 5th to 16th bytes is verified against the data at addresses 027EF4H to 027EFFH in the flash memory, respectively. 6. From the controller to the device The 17th byte contains CHECKSUM data. The CHECKSUM data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 5th to 16th bytes by unsigned 8-bit addition (ignoring any overflow). For details on CHECKSUM, see " 13.4.17 How to Calculate CHECKSUM ". 7. From the device to the controller The data in the 18th byte is the ACK response data to the 5th to 17th bytes (ACK response to the CHECKSUM value). The device first checks to see whether the data received in the 5th to 17th bytes contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) 18H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are the upper four bits of the immediately preceding operation command data, so the value of these bits is "1". Next, the device checks the CHECKSUM data in the 17th byte. This check is made to see if the lower 8-bit value obtained by summing the data in the 5th to 17th bytes by unsigned 8-bit addition (ignoring any overflow) is 00H. If the value is not 00H, the device returns the ACK response data for CHECKSUM error (bit 0) 11H and waits for the next operation command data (3rd byte). Finally, the device examines the result of password verification. If all the data in the 5th to 16th bytes is not verified correctly, the device returns the ACK response data for password error (bit 0) 11H and waits for the next operation command data (3rd byte). If no error is found in all the above checks, the device returns the ACK response data for normal reception 10 H. 8. From the controller to the device The data in the 19th to 22nd bytes indicates the RAM start address for storing block transfer data. The 19th byte corresponds to address bits 31 to 24, the 20th byte to address bits 23 to 16, the 21st byte to address bits 15 to 8, and the 22nd byte to address bits 7 to 0. 9. From the controller to the device The data in the 23rd and 24th bytes indicates the number of bytes to be transferred. The 23rd byte corresponds to bits 15 to 8 of the transfer byte count and the 24th byte corresponds to bits 7 to 0. 10. From the controller to the device The data in the 25th byte is CHECKSUM data. The CHECKSUM data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 19th to 24th bytes by unsigned 8-bit addition (ignoring any overflow). For details on CHECKSUM, see " 13.4.17 How to Calculate CHECKSUM ".
Note: The data in the 19th to 25th bytes should be placed within addresses 001000H to 001DFFH (3.5Kbytes) in the internal RAM.
Page 210
2007-10-10
TMP91FU62
11. From the device to the controller The data in the 26th byte is the ACK response data to the data in the 19th to 25th bytes (ACK response to the CHECKSUM value). The device first checks to see whether the data received in the 19th to 25th bytes contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) 18H and waits for the next operation command (3rd byte). The upper four bits of the ACK response data are the upper four bits of the immediately preceding operation command data, so the value of these bits is "1". Next, the device checks the CHECKSUM data in the 25th byte. This check is made to see if the lower 8-bit value obtained by summing the data in the 19th to 25th bytes by unsigned 8-bit addition (ignoring any overflow) is 00H. If the value is not 00H, the device returns the ACK response data for CHECKSUM error (bit 0) 11H and waits for the next operation command data (3rd byte). 12. From the controller to the device The data in the 27th to m'th bytes is the data to be stored in the RAM. This data is written to the RAM starting at the address specified in the 19th to 22nd bytes. The number of bytes to be written is specified in the 23rd and 24th bytes. 13. From the controller to the device The data in the (m+1)th byte is CHECKSUM data. The CHECKSUM data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in the 27th to m'th bytes by unsigned 8-bit addition (ignoring any overflow). For details on CHECKSUM, see " 13.4.17 How to Calculate CHECKSUM ". 14. From the device to the controller The data in the (m+2)th byte is the ACK response data to the 27th to (m+1)th bytes (ACK response to the CHECKSUM value). The device first checks to see whether the data in the 27th to (m+1)th byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) 18H and waits for the next operation command (3rd byte). The upper four bits of the ACK response are the upper four bits of the immediately preceding operation command data, so the value of these bits is "1". Next, the device checks the CHECKSUM data in the (m+1)th byte. This check is made to see if the lower 8-bit value obtained by summing the data in the 27th to (m+1)th bytes by unsigned 8-bit addition (ignoring any overflow) is 00H. If the value is not 00H, the device returns the ACK response data for CHECKSUM error (bit 0) 11H and waits for the next operation command data (3rd byte). If no error is found in all the above checks, the device returns the ACK response data for normal reception 10H. 15. From the device to the controller If the ACK response data in the (m+2)th byte is 10H (normal reception), the boot program then jumps to the RAM start address specified in the 19th to 22nd bytes.
Page 211
2007-10-10
TMP91FU62
13.4.9 Flash Memory SUM command
See Table 13-9. 1. The data in the 1st and 2nd bytes is the same as in the case of the RAM Transfer command. 2. From the controller to the device The data in the 3rd byte is operation command data. The Flash Memory SUM command data (20H) is sent here. 3. From the device to the controller The data in the 4th byte is the ACK response data to the operation command data in the 3rd byte. The device first checks to see if the data in the 3rd byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) Then, if the data in the 3rd byte corresponds to one of the operation command values given in Table 13-7, the device echoes back the received data (ACK response for normal reception). In this case, 20H is echoed back and execution then branches to the flash memory SUM processing routine. If the data in the 3rd byte does not correspond to any operation command, the device returns the ACK response data for operation command error (bit 0) x1H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) 4. From the device to the controller The data in the 5th and 6th bytes is the upper and lower data of the SUM value, respectively. For details on SUM, see " 13.4.16 How to Calculate SUM ". 5. From the device to the controller The data in the 7th byte is CHECKSUM data. This is the two's complement of the lower 8-bit value obtained by summing the data in the 5th and 6th bytes by unsigned 8-bit addition (ignoring any overflow). 6. From the controller to the device The data in the 8th byte is the next operation command data.
Page 212
2007-10-10
TMP91FU62
13.4.10Product Information Read command
See Table 13-10. 1. The data in the 1st and 2nd bytes is the same as in the case of the RAM Transfer command. 2. From the controller to the device The data in the 3rd byte is operation command data. The Product Information Read command data (30H) is sent here. 3. From the device to the controller The data in the 4th byte is the ACK response data to the operation command data in the 3rd byte. The device first checks to see if the data in the 3rd byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) Then, if the data in the 3rd byte corresponds to one of the operation command values given in Table 13-7, the device echoes back the received data (ACK response for normal reception). In this case, 30H is returned and execution then branches to the product information read processing routine. If the data in the 3rd byte does not correspond to any operation command, the device returns the ACK response data for operation command error (bit 0) x1H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) 4. From the device to the controller The data in the 5th to 8th bytes is the data stored at addresses 027EF0H to 027EF3H in the flash memory. By writing the ID information of software at these addresses, the version of the software can be managed. (For example, 0002H can indicate that the software is now in version 2.) 5. From the device to the controller The data in the 9th to 20th bytes denotes the part number of the device. 'TMP91FU62_ _ _' is sent in ASCII code starting from the 9th byte. Note: An underscore ('_') indicates a space. 6. From the device to the controller The data in the 21st to 24th bytes is the password comparison start address. F4H, 7EH, 02H and 00H are sent starting from the 21st byte. 7. From the device to the controller The data in the 25th to 28th bytes is the RAM start address. 00H, 10H, 00H and 00H are sent starting from the 25th byte. 8. From the device to the controller The data in the 29th to 32nd bytes is the RAM (user area) end address. FFH, 1DH, 00H and 00H are sent starting from the 29th byte. 9. From the device to the controller The data in the 33rd to 36th bytes is the RAM end address. FFH, 1FH, 00H and 00H are sent starting from the 33rd byte. 10. From the device to the controller The data in the 37th to 44th bytes is dummy data. 11. From the device to the controller The data in the 45th and 46th bytes contains the protection status and sector division information of the flash memory. >Bit 0 indicates the read protection status. 0: Read protection is applied. Page 213
2007-10-10
TMP91FU62
1: Read protection is not applied. >Bit 1 indicates the write protection status. 0: Write protection is applied. 1: Write protection is not applied. >Bit 2 indicates whether or not the flash memory is divided into sectors. 0: The flash memory is divided into sectors. 1: The flash memory is not divided into sectors. >Bits 3 to 15 are sent as "0". 12. From the device to the controller The data in the 47th to 50th bytes is the flash memory start address. 00H, 00H, 01H and 00H are sent starting from the 47th byte. 13. From the device to the controller The data in the 51st to 54th bytes is the flash memory end address. FFH, 7FH, 02H and 00H are sent starting from the 51st byte. 14. From the device to the controller The data in the 55th and 56th bytes indicates the number of sectors in the flash memory. 0CH and 00H are sent starting from the 55th byte. 15. From the device to the controller The data in the 57th to 65th bytes contains sector information of the flash memory. Sector information is comprised of the start address (starting from the flash memory start address), sector size and number of consecutive sectors of the same size. Note that the sector size is represented in word units. The data in the 57th to 65th bytes indicates 8 Kbytes of sectors (sector 0 to sector 11). For the data to be transferred, see Table 13-10. 16. From the device to the controller The data in the 66th byte is CHECKSUM data. This is the two's complement of the lower 8-bit value obtained by summing the data in the 5th to 65th bytes by unsigned 8-bit addition (ignoring any overflow). 17. From the controller to the device The data in the 67th byte is the next operation command data.
Page 214
2007-10-10
TMP91FU62
13.4.11Flash Memory Chip Erase Command
See Table 13-11. 1. The data in the 1st and 2nd bytes is the same as in the case of the RAM Transfer command. 2. From the controller to the device The data in the 3rd byte is operation command data. The Flash Memory Chip Erase command data (40H) is sent here. 3. From the device to the controller The data in the 4th byte is the ACK response data to the operation command data in the 3rd byte. The device first checks to see if the data in the 3rd byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) Then, if the data in the 3rd byte corresponds to one of the operation command values given in Table 13-7, the device echoes back the received data (ACK response for normal reception). In this case, 40H is echoed back. If the data in the 3rd byte does not correspond to any operation command, the device returns the ACK response data for operation command error (bit 0) x1H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) 4. From the controller to the device The data in the 5th byte is Erase Enable command data (54H). 5. From the device to the controller The data in the 6th byte is the ACK response data to the Erase Enable command data in the 5th byte. The device first checks to see if the data in the 5th byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined (They are the upper four bits of the immediately preceding operation command data.) Then, if the data in the 5th byte corresponds to the Erase Enable command data, the device echoes back the received data (ACK response for normal reception). In this case, 54H is echoed back and execution jumps to the flash memory chip erase processing routine. If the data in the 5th byte does not correspond to the Erase Enable command data, the device returns the ACK response data for operation command error (bit 0) x1H and waits for the next operation command (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) 6. From the device to the controller The data in the 7th byte indicates whether or not the erase operation has completed successfully. If the erase operation has completed successfully, the device returns the end code (4FH). If an erase error has occurred, the device returns the error code (4CH). 7. From the device to the controller The data in the 8th byte is ACK response data. If the erase operation has completed successfully, the device returns the ACK response for erase completion (5DH). If an erase error has occurred, the device returns the ACK response for erase error (60H). 8. From the controller to the device The data in the 9th byte is the next operation command data.
Page 215
2007-10-10
TMP91FU62
13.4.12Flash Memory Protect Set command
See Table 13-12. 1. The data in the 1st and 2nd bytes is the same as in the case of the RAM Transfer command. 2. From the controller to the device The data in the 3rd byte is operation command data. The Flash Memory Protect Set command data (60H) is sent here. 3. From the device to the controller The data in the 4th byte is the ACK response data to the operation command data in the 3rd byte. The device first checks to see if the data in the 3rd byte contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) x8H and waits for the next operation command data. The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) Then, if the data in the 3rd byte corresponds to one of the operation command data values given in Table 13-7, the device echoes back the received data (ACK response for normal reception). In this case, 60H is echoed back and execution branches to the flash memory protect set processing routine. After branching to this routine, the data in the password area is checked. For details, see " 13.4.15 Password ". If the data in the 3rd byte does not correspond to any operation command, the device returns the ACK response data for operation command error (bit 0) x1H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are undefined. (They are the upper four bits of the immediately preceding operation command data.) 4. From the controller to the device The data in the 5th to 16th bytes is password data (12 bytes). The data in the 5th byte is verified against the data at address 027EF4H in the flash memory and the data in the 6th byte against the data at address 027EF5H. In this manner, the received data is verified consecutively against the data at the specified address in the flash memory. The data in the 16th byte is verified against the data at address 027EFFH in the flash memory. 5. From the controller to the device The data in the 17th byte is CHECKSUM data. The CHECKSUM data sent by the controller is the two's complement of the lower 8-bit value obtained by summing the data in 5th to 16th bytes by unsigned 8-bit addition (ignoring any overflow). For details on CHECKSUM, see " 13.4.17 How to Calculate CHECKSUM ". 6. From the device to the controller The data in the 18th byte is the ACK response data to the data in the 5th to 17th bytes (ACK response to the CHECKSUM value). The device first checks to see whether the data in the 5th to 17th bytes contains any error. If a receive error is found, the device returns the ACK response data for communications error (bit 3) 68H and waits for the next operation command data (3rd byte). The upper four bits of the ACK response data are the upper four bits of the immediately preceding operation command data, so the value of these bits is "6". Then, the device checks the CHECKSUM data in the 17th byte. This check is made to see if the lower 8 bits of the value obtained by summing the data in the 5th to 17th bytes by unsigned 8-bit addition (ignoring any overflow) is 00H. If the value is not 00H, the device returns the ACK response data for CHECKSUM error (bit 0) 61H and waits for the next operation command data (3rd byte). Finally, the device examines the result of password verification. If all the data in the 5th to 16th bytes is not verified correctly, the device returns the ACK response data for password error (bit 0) 61H and waits for the next operation command data (3rd byte). If no error is found in the above checks, the device returns the ACK response data for normal reception 60H.
Page 216
2007-10-10
TMP91FU62
7. From the device to the controller The data in the 19th byte indicates whether or not the protect set operation has completed successfully. If the operation has completed successfully, the device returns the end code (6FH). If an error has occurred, the device returns the error code (6CH). 8. From the device to the controller The data in the 20th byte is ACK response data. If the protect set operation has completed successfully, the device returns the ACK response data for normal completion (31H). If an error has occurred, the device returns the ACK response data for error (34H). 9. From the device to the controller The data in the 21st byte is the next operation command data.
13.4.13ACK Response Data
The boot program notifies the controller of its processing status by sending various response data. Table 1313 to Table 13-18 show the ACK response data returned for each type of received data. The upper four bits of ACK response data are a direct reflection of the upper four bits of the immediately preceding operation command data. Bit 3 indicates a receive error and bit 0 indicates an operation command error, CHECKSUM error or password error. Table 13-13 ACK Response Data to Serial Operation Mode Setting Data
Transfer Data
86H
Meaning
The device can communicate in UART mode. (Note)
Note: If the desired baud rate cannot be set, the device returns no data and terminates operation.
Table 13-14 ACK Response Data to Operation Command Data
Transfer data
x8H (Note) x6H (Note) x1H (Note) 10H 20H 30H 40H 60H
Meaning
A receive error occurred in the operation command data. Terminated receive operation due to protection setting. Undefined operation command data was received normally. Received the RAM Transfer command. Received the Flash Memory SUM command. Received the Product Information Read command. Received the Flash Memory Chip Erase command. Received the Flash Memory Protect Set command.
Note:The upper four bits are a direct reflection of the upper four bits of the immediately preceding operation command data.
Table 13-15 ACK Response data to CHECKSUM Data for RAM Transfer Command
Transfer data
18H 11H 10H A receive error occurred. A CHECKSUM error or password error occurred. Received the correct CHECKSUM value.
Meaning
Page 217
2007-10-10
TMP91FU62
Table 13-16 ACK Response Data to Flash Memory Chip Erase Operation
Transfer data
54H 4FH 4CH 5DH (Note) 60H (Note) Received the Erase Enable command. Completed erase operation. An erase error occurred. Reconfirmation of erase operation Reconfirmation of erase error
Meaning
Note:These codes are returned for reconfirmation of communications.
Table 13-17 ACK Response Data to CHECKSUM Data for Flash Memory Protect Set Command
Transfer data
68H 61H 60H A receive error occurred. A CHECKSUM or password error occurred. Received the correct CHECKSUM value.
Meaning
Table 13-18 ACK Response Data to Flash Memory Protect Set Operation
Transfer data
6FH 6CH 31H (Note) 34H (Note)
Meaning
Completed the protect (read/write) set operation. A protect (read/write) set error occurred. Reconfirmation of protect (read/write) set operation Reconfirmation of protect (read/write) set error
Note:These codes are returned for reconfirmation of communications.
13.4.14Determining Serial Operation Mode
To communicate in UART mode, the controller should transmit the data value 86H as the first byte at the desired baud rate. Figure 13-7 shows the waveform of this operation.
Figure 13-7 Data for Determining Serial Operation Mode
The boot program receives the first byte (86H) after reset release not as serial communications data. Instead, the boot program uses the first byte to determine the baud rate. The baud rate is determined by the output periods of tAB, tAC and tAD as shown in Figure 13-7 using the procedure shown in Figure 13-8. The CPU monitors the level of the receive pin. Upon detecting a level change, the CPU captures the timer value to determine the baud rate.
Page 218
2007-10-10
TMP91FU62
Start
Initialize 16-bit timer B0 (T1 = 8/fc, clear counter) Start the prescaler
Point A
Receive pin changed from High to Low? YES Start counting up of 16-bit timer B0
Point B
Receive pin changed from Low to High? YES Capture timer value (tAB) by software
Point C
Receive pin changed from High to Low? YES Capture timer value (tAC) by software
Point D
Receive pin changed from Low to High? YES Capture timer value (tAD) by software
Stop 16-bit timer B0
tAC tAD?
YES
Back up tAD value Stop operation (Endless loop)
End
Figure 13-8 Flowchart for Serial Operation Mode Receive Operation
Page 219
2007-10-10
TMP91FU62
13.4.15Password
When the RAM Transfer command (10H) or the Flash Memory Protect Set command (60H) is received as operation command data, password verification is performed. First, the device echoes back the operation command data (10H to 60H) and checks the data (12 bytes) in the password area (addresses 027EF4H to 027EFFH). Then, the device verifies the password data received in the 5th to 16th bytes against the data in the password area as shown in Table 13-19. Unless all the 12 bytes are verified correctly, a password error will occur. A password error will also occur if all the 12 bytes of password data contain the same value. Only exception is when all the 12 bytes are "FFH" and verified correctly and the reset vector area (addresses 027F00H to 027F02H) is all "FFH". In this case, a blank device will be assumed and no password error will occur. If a password error has occurred, the device returns the ACK response data for password error in the 18th byte. Table 13-19
Receive data 5th byte 6th byte 7th byte 8th byte 9th byte 10th byte 11th byte 12th byte 13th byte 14th byte 15th byte 16th byte
Password Verification Table
Data to be verified against Data at address 027EF4H Data at address 027EF5H Data at address 027EF6H Data at address 027EF7H Data at address 027EF8H Data at address 027EF9H Data at address 027EFAH Data at address 027EFBH Data at address 027EFCH Data at address 027EFDH Data at address 027EFEH Data at address 027EFFH
Example of data that cannot be specified as a password For blank products (Note) The password of a blank product must be all "FFH" (FFH, FFH, FFH, FFH, FFH, FFH, FFH, FFH, FFH, FFH, FFH, FFH).
Note:A blank product is a product in which all the bytes in the password area (addresses 02FEF4H to 02FEFFH) and the reset vector area (addresses 02FF00H to 02FF02H) are "FFH". For programmed products The same 12 consecutive bytes cannot be specified as a password. The table below shows password error examples.
Programmed product Error example 1 Error example 2 Error example 3
1 FFH 00H 5AH
2 FFH 00H 5AH
3 FFH 00H 5AH
4 FFH 00H 5AH
5 FFH 00H 5AH
6 FFH 00H 5AH
7 FFH 00H 5AH
8 FFH 00H 5AH
9 FFH 00H 5AH
10 FFH 00H 5AH
11 FFH 00H 5AH
12 FFH 00H 5AH
Note ALL"FF" ALL"00" ALL"5A"
Page 220
2007-10-10
TMP91FU62 13.4.16How to Calculate SUM
SUM is calculated by summing the values of all data read from the flash memory by unsigned 8-bit addition and is returned as a word (16-bit) value. The resulting SUM value is sent to the controller in order of upper 8 bits and lower 8 bits. All the 96 Kbytes of data in the flash memory are included in the calculation of SUM. When the Flash Memory SUM command is executed, SUM is calculated in this way.
13.4.17How to Calculate CHECKSUM
CHECKSUM is calculated by taking the two's complement of the lower 8-bit value obtained by summing the values of received data by unsigned 8-bit addition (ignoring any overflow). When the Flash Memory SUM command or the Product Information Read command is executed, CHECKSUM is calculated in this way. The controller should also use this CHECKSUM calculation method for sending CHECKSUM values. Example: Calculating CHECKSUM for the Flash Memory SUM command When the upper 8-bit data of SUM is E5H and the lower 8-bit data is F6H, CHECKSUM is calculated as shown below. First, the upper 8 bits and lower 8 bits of the SUM value are added by unsigned operation. E5H+F6H = 1DBH
Then, the two's complement of the lower 8 bits of this result is obtained as shown below. The resulting CHECKSUM value (25H) is sent to the controller. 0-DBH = 25H
13.5 User Boot Mode (in Single Chip Mode)
User Boot mode, which is a sub mode of Single Chip mode, enables a user-created flash memory program/erase routine to be used. To do so, the operation mode of Single Chip mode must be changed from Normal mode for executing a user application program to User Boot mode for programming/erasing the flash memory. For example, the reset processing routine of a user application program may include a routine for selecting Normal mode or User Boot mode upon entering Single Chip mode. Any mode-selecting condition may be set using the device's I/O to suit the user system. To program/erase the flash memory in User Boot mode, a program/erase routine must be incorporated in the user application program in advance. Since the processor cannot read data from the internal flash memory while it is being programmed or erased, the program/erase routine must be executed from the outside of the flash memory. While the flash memory is being programmed/erased in User Boot mode, interrupts must be disabled. The pages that follow explain the procedure for programming the flash memory using two example cases. In one case the program/erase routine is stored in the internal flash memory (1-A); in the other the program/erase routine is transferred from an external source (1-B).
Page 221
2007-10-10
TMP91FU62
13.5.1 (1-A) Program/Erase Procedure Example 1
When the program/erase routine is stored in the internal flash memory (Step-1)Environment setup First, the condition (e.g. pin status) for entering User Boot mode must be set and the I/O bus for transferring data must be determined. Then, the device's peripheral circuitry must be designed and a corresponding program must be written. Before mounting the device on the board, it is necessary to write the following four routines into one of the sectors in the flash memory. (a)Mode select routine: Selects Normal mode or User Boot mode. (b)Program/erase routine: Loads program/erase data from an external source and programs/erases the flash memory. (c)Copy routine 1: Copies routines (a) to (d) into the internal RAM or external memory. (d)Copy routine 2: Copies routines (a) to (d) from the internal RAM or external memory into the flash memory.
Note:The above (d) is a routine for reconstructing the program/erase routine on the flash memory. If the entire flash memory is always programmed and the program/erase routine is included in the new user application program, this copy routine is not needed.
Page 222
2007-10-10
TMP91FU62
(Step-2) Entering User Boot mode (using the reset processing) After reset release, the reset processing program determines whether or not the device should enter User Boot mode. If the condition for entering User Boot mode is true, User Boot mode is entered to program/ erase the flash memory.
(Step-3) Copying the program/erase routine After the device has entered User Boot mode, the copy routine 1 (c) copies the routines (a) to (d) into the internal RAM or external memory (The routines are copied into the internal RAM here.)
Page 223
2007-10-10
TMP91FU62
(Step-4) Erasing the flash memory by the program/erase routine Control jumps to the program/erase routine in the RAM and the old user program area is erased (sector erase or chip erase). (In this case, the flash memory erase command is issued from the RAM.)
Note: If data is erased on a sector basis and the routines (a) to (d) are left in the flash memory, only the program/ erase routine (b) need be copied into the RAM.
(Step-5) Restoring the user boot program in the flash memory The copy routine 2 (d) in the RAM copies the routines (a) to (d) into the flash memory.
Note: If data is erased on a sector basis and the routines (a) to (d) are left in the flash memory, step 5 is not needed.
Page 224
2007-10-10
TMP91FU62
(Step-6) Writing the new user application program to the flash memory The program/erase routine in the RAM is executed to load the new user application program from the controller into the erased area of the flash memory.
(Step-7) Executing the new user application program The RESET input pin is driven Low ("0") to reset the device. The mode setting condition is set for Normal mode. After reset release, the device will start executing the new user application program.
Page 225
2007-10-10
TMP91FU62
13.5.2 (1-B) Program/Erase Procedure Example 2
In this example, only the boot program (minimum requirement) is stored in the flash memory and other necessary routines are supplied from the controller. (Step-1)Environment setup First, the condition (e.g. pin status) for entering User Boot mode must be set and the I/O bus for transferring data must be determined. Then, the device's peripheral circuitry must be designed and a corresponding program must be written. Before mounting the device on the board, it is necessary to write the following two routines into one on the sectors in the flash memory. (a)Mode select routine: Selects Normal mode or User Boot mode. (b)Transfer routine: Loads the program/erase routine from an external source. The following routines are prepared on the controller. (c)Program/erase routine: Programs/erases the flash memory. (d)Copy routine 1: Copies routines (a) and (b) into the internal RAM or external memory. (e)Copy routine 2: Copies routines (a) and (b) from the internal RAM or external memory into the flash memory.
Page 226
2007-10-10
TMP91FU62
(Step-2) Entering User Boot mode (using the reset processing) The following explanation assumes that these routines are incorporated in the reset processing program. After reset release, the reset processing program first determines whether or not the device should enter User Boot mode. If the condition for entering User Boot mode is true, User Boot mode is entered to program/erase the flash memory.
(Step-3) Copying the program/erase routine to the internal RAM After the device has entered User Boot mode, the transfer routine (b) transfers the routines (c) to (e) from the controller to the internal RAM (or external memory). (The routines are copied into the internal RAM here.)
Page 227
2007-10-10
TMP91FU62
(Step-4) Executing the copy routine 1 in the internal RAM Control jumps to the internal RAM and the copy routine 1 (d) copies the routines (a) and (b) into the internal RAM.
(Step-5) Erasing the flash memory by the program/erase routine The program/erase routine (c) erases the old user program area.
Page 228
2007-10-10
TMP91FU62
(Step-6) Restoring the user boot program in the flash memory The copy routine (e) copies the routines (a) and (b) from the internal RAM into the flash memory.
(Step-7) Writing the new user application program to the flash memory The program/erase routine (c) in the RAM is executed to load the new user application program from the controller into the erased area of the flash memory.
Page 229
2007-10-10
TMP91FU62
(Step-8) Executing the new user application program The RESET input pin is driven Low ("0") to reset the device. The mode setting condition is set for Normal mode. After reset release, the device will start executing the new user application program.
Page 230
2007-10-10
TMP91FU62
13.6 Flash Memory Command Sequences
The operation of the flash memory is comprised of six commands, as shown in Table 13-20. Addresses specified in each command sequence must be in an area where the flash memory is mapped. For details, see Table 13-3. Table 13-20 Command Sequences
Command Sequence 1 Single Word Program Sector Erase (8KB Erase) Chip Erase (All Erase) Product ID Entry Product ID Exit 5 Product ID Exit Read Protect Set 6 Write Protect Set AAAH AAH 554H 55H AAAH A5H 77EH 0FH (Note3) AAAH AAAH AAH AAH 554H 554H 55H 55H AAAH AAAH F0H A5H 77EH F0H (Note3) 1st Bus Write Cycle Addr. AAAH Data AAH 2nd Bus Write Cycle Addr. 554H Data 55H 3rd Bus Write Cycle Addr. AAAH Data A0H 4th Bus Write Cycle Addr. PA (Note1) AAAH Data PD (Note1) AAH 554H 55H SA (Note2) AAAH 30H 5th Bus Write Cycle Addr. Data 6th Bus Write Cycle Addr. Data
2
AAAH
AAH
554H
55H
AAAH
80H
3 4
AAAH AAAH xxH
AAH AAH F0H
554H 554H
55H 55H
AAAH AAAH
80H 90H
AAAH
AAH
554H
55H
10H
Note 1: PA = Program Word address, PD = Program Word data Set the address and data to be programmed. Even-numbered addresses should be specified here. Note 2: SA = Sector Erase address, Each sector erase range is selected by address A23 to A13. Note 3: When apply read protect and write protect, be sure to program the data of 00H.
Table 13-21 Hardware Sequence Flags
Status Single Word Program During auto operation Sector Erase/Chip Erase Read Protect Set/Write Protect Set D7 D7 0 Cannot be used D6 Toggle Toggle Toggle
Note: D15 to D8 and D5 to D0 are "don't care".
Page 231
2007-10-10
TMP91FU62
13.6.1 Single Word Program
The Single Word Program command sequence programs the flash memory on a word basis. The address and data to be programmed are specified in the 4th bus write cycle. It takes a maximum of 60 us to program a single word. Another command sequence cannot be executed until the write operation has completed. This can be checked by reading the same address in the flash memory repeatedly until the same data is read consecutively. While a write operation is in progress, bit 6 of data is toggled each time it is read.
Note:To rewrite data to Flash memory addresses at which data (including FFFFH) is already written, make sure to erase the existing data by "sector erase" or "chip erase" before rewriting data.
13.6.2 Sector Erase (8-Kbyte Erase)
The Sector Erase command sequence erases 8 Kbytes of data in the flash memory at a time. The flash memory address range to be erased is specified in the 6th bus write cycle. For the address range of each sector, see Table 13-3. This command sequence cannot be used in Programmer mode. It takes a maximum of 75 ms to erase 8 Kbytes. Another command sequence cannot be executed until the erase operation has completed. This can be checked by reading the same address in the flash memory repeatedly until the same data is read consecutively. While a erase operation is in progress, bit 6 of data is toggled each time it is read.
13.6.3 Chip Erase (All Erase)
The Chip Erase command sequence erases the entire area of the flash memory. It takes a maximum of 300 ms to erase the entire flash memory. Another command sequence cannot be executed until the erase operation has completed. This can be checked by reading the same address in the flash memory repeatedly until the same data is read consecutively. While a erase operation is in progress, bit 6 of data is toggled each time it is read. Erase operations clear data to FFH.
13.6.4 Product ID Entry
When the Product ID Entry command is executed, Product ID mode is entered. In this mode, the vendor ID, flash macro ID, flash size ID, and read/write protect status can be read from the flash memory. In Product ID mode, the data in the flash memory cannot be read.
13.6.5 Product ID Exit
This command sequence is used to exit Product ID mode.
Page 232
2007-10-10
TMP91FU62
13.6.6 Read Protect Set
The Read Protect Set command sequence applies read protection on the flash memory. When read protection is applied, the flash memory cannot be read in Programmer mode and the RAM Transfer command cannot be executed in Single Boot mode. To cancel read protection, it is necessary to execute the Chip Erase command sequence. To check whether or not read protection is applied, read xxx77EH in Product ID mode. It takes a maximum of 60 us to set read protection on the flash memory. Another command sequence cannot be executed until the read protection setting has completed. This can be checked by reading the same address in the flash memory repeatedly until the same data can be read consecutively. While a read protect operation is in progress, bit 6 of data is toggled each time it is read.
13.6.7 Write Protect Set
The Write Protect Set command sequence applies write protection on the flash memory. When write protection is applied, the flash memory cannot be written to in Programmer mode and the RAM Transfer command cannot be executed in Single Boot mode. To cancel write protection, it is necessary to execute the Chip Erase command sequence. To check whether or not write protection is applied, read xxx77EH in Product ID mode. It takes a maximum of 60 us to set write protection. Another command sequence cannot be executed until the write protection setting has completed. This can be checked by reading the same address in the flash memory repeatedly until the same data can be read consecutively. While a write protect operation is in progress, bit 6 of data is toggled each time it is read.
13.6.8 Hardware Sequence Flags
The following hardware sequence flags are available to check the auto operation execution status of the flash memory. 1. Data polling (D7) When data is written to the flash memory, D7 outputs the complement of its programmed data until the write operation has completed. After the write operation has completed, D7 outputs the proper cell data. By reading D7, therefore, the operation status can be checked. While the Sector Erase or Chip Erase command sequence is being executed, D7 outputs "0". After the command sequence is completed, D7 outputs "1" (cell data). Then, the data written to all the bits can be read after waiting for 1 us. When read/write protection is applied, the data polling function cannot be used. Instead, use the toggle bit (D6) to check the operation status. 2. Toggle bit (D6) When the Flash Memory Program, Sector Erase, Chip Erase, Write Protect Set, or Read Protect Set command sequence is executed, bit 6 (D6) of the data read by read operations outputs "0" and "1" alternately each time it is read until the processing of the executed command sequence has completed. The toggle bit (D6) thus provides a software means of checking whether or not the processing of each command sequence has completed. Normally, the same address in the flash memory is read repeatedly until the same data is read successively. The initial read of the toggle bit always returns "1".
Note:The flash memory incorporated in the TMP91FU62 does not have an exceed-time-limit bit (D5). It is therefore necessary to set the data polling time limit and toggle bit polling time limit so that polling can be stopped if the time limit is exceeded.
Page 233
2007-10-10
TMP91FU62 13.6.9 Data Read
Data is read from the flash memory in byte units or word units. It is not necessary to execute a command sequence to read data from the flash memory.
13.6.10Programming the Flash Memory by the Internal CPU
The internal CPU programs the flash memory by using the command sequences and hardware sequence flags described above. However, since the flash memory cannot be read during auto operation mode, the program/ erase routine must be executed outside of the flash memory. The CPU can program the flash memory either by using Single Boot mode or by using a user-created protocol in Single Chip mode (User Boot). 1. Single Boot: The microcontroller is started up in Single Boot mode to program the flash memory by the internal boot ROM program. In this mode, the internal boot ROM is mapped to an area including the interrupt vector table, in which the boot ROM program is executed. The flash memory is mapped to an address area different from the boot ROM area. The boot ROM program loads data into the flash memory by serial transfer. In Single Boot mode, interrupts must be disabled including non-maskable interrupts. For details, see " 13.4 Single Boot Mode " 2. User Boot: In this method, the flash memory is programmed by executing a user-created routine in Single Chip mode (normal operation mode). In this mode, the user-created program/erase routine must also be executed outside of the flash memory. It is also necessary to disable interrupts including nonmaskable interrupts. The user should prepare a flash memory program/erase routine (including routines for loading write data and writing the loaded data into the flash memory). In the main program, normal operation is switched to flash memory programming operation to execute the flash memory program/erase routine outside of the flash memory area. For example, the flash memory program/erase routine may be transferred from the flash memory to the internal RAM and executed there or it may be prepared and executed in external memory. For details, see " 13.5 User Boot Mode (in Single Chip Mode) ".
Page 234
2007-10-10
TMP91FU62
Flowcharts: Flash memory access by the internal CPU
Single Word Program
(See the flowchart below)
Timeout(60
s)
Addr. =
No
Yes
Addr. =
No
Yes
Address = Address + 2 (Even-numbered address/ word units)
No
Yes
xxxAAAH/AAH
xxx554H/55H
xxxAAAH/A0H
Page 235
2007-10-10
TMP91FU62
Chip Erase/Sector Erase
Page 236
2007-10-10
TMP91FU62
Read/Write Protect Set
Start
Protect Set command sequence (See the flowchart below)
Toggle bit (D6)
Timeout (60 s)
Product ID Entry
Byte read (D7 to D0) Addr. = xxx77EH
Product ID Exit
Read data matched program data? Yes Protect Set end
No
Abnormal end
Protect Set Command Sequence (Address/Data) xxxAAAH/AAH
xxx554H/55H
xxxAAAH/A5H
Set read protect xxx77EH/F0H Set write protect xxx77EH/0FH Set both read protect and write protect xxx77EH/00H
Page 237
2007-10-10
TMP91FU62
Data Polling (D7)
Toggle Bit (D6)
Note:Hardware sequence flags are read from the flash memory in byte units or word units. VA:In Single Word Program, VA denotes the address to be programmed. In Sector Erase, VA denotes any address in the selected sector. In Chip Erase, VA denotes any address in the flash memory. In Read Protect Set, VA denotes the protect set address (xx77EH). In Write Protect Set, VA denotes the protect set address (xx77EH).
Page 238
2007-10-10
TMP91FU62
Product ID Entry
Product ID Exit
Page 239
2007-10-10
TMP91FU62
(Example: Program to be loaded and executed in RAM) Erase the flash memory (chip erase) and then write 0706H to address FE8000H.
;#### Flash memory chip erase processing #### ld XIX, 0xFE8000 ; set start address
CHIPERASE: ld ld ld ld ld ld (0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0x80 (0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0x10 ;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle ;4th Bus Write Cycle ;5th Bus Write Cycle ;6th Bus Write Cycle
cal
TOGGLECHK
; check toggle bit
CHIPERASE _ LOOP: ld cp j cp j WA, (XIX+) WA, 0xFFFF ne,CHIPERASE _ ERR XIX, 0xFFFFFF ULT,CHIPERASE _ LOOP ; read data from flash memory ; blank data? ; if not blank data, jump to error processing ; end address (0xFFFFFF)? ; check entire memory area and then end loop processing
;#### Flash memory program processing #### ld ld
PROGRAM:
XIX, 0xFE8000 WA, 0x0706
; set program address ; set program data
ld ld ld ld
(0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0xA0 (XIX), WA
;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle ;4th Bus Write Cycle
cal
TOGGLECHK
; check toggle bit
ld cp j ld cp j
BC, (XIX) WA, BC ne, PROGRAM _ ERR BC, (XIX) WA, BC ne, PROGRAM _ ERR
; read data from flash memory
; if programmed data cannot be read, error is determined ; read data from flash memory
; if programmed data cannot be read, error is determined
PROGRAM _ END: j PROGRAM _ END ; program operation end
Page 240
2007-10-10
TMP91FU62
;#### Toggle bit (D6) check processing #### TOGGLECHK: ld and ld L, (XIX) L, 0y01000000 H, L ; check toggle bit (D6) ; save first toggle bit data
TOGGLECHK1: ld and cp j ld j L, (XIX) L, 0y01000000 L, H z, TOGGLECHK2 H, L TOGGLECHK1 ; check toggle bit (D6) ; toggle bit = toggled? ; if not toggled, end processing ; save current toggle bit state ; recheck toggle bit
TOGGLECHK2: ret
;#### Error processing #### CHIPERASE _ ERR: j CHIPERASE _ ERR ; chip erase error
PROGRAM _ ERR: j PROGRAM _ ERR ; program error
Page 241
2007-10-10
TMP91FU62
(Example: Program to be loaded and executed in RAM) Erase data at addresses FF0000H to FF1FFFH (sector erase) and then write 0706H to address FF0000H.
;#### Flash memory sector erase processing #### ld XIX, 0xFF0000 ; set start address
SECTORERASE: ld ld ld ld ld ld (0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0x80 (0xFE8AAA), 0xAA (0xFE8554), 0x55 (XIX), 0x30 ;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle ;4th Bus Write Cycle ;5th Bus Write Cycle ;6th Bus Write Cycle
cal
TOGGLECHK
; check toggle bit
SECTORERASE _ LOOP: ld cp j cp j WA, (XIX+) WA, 0xFFFF ne,SECTORERASE _ ERR XIX, 0xFF1FFF ULT,SECTORERASE _ LOOP ; read data from flash memory ; blank data? ; if not blank data, jump to error processing ; end address (0xFF1FFF)? ; check erased sector area and then end loop processing
;#### Flash memory program processing #### ld ld
PROGRAM:
XIX, 0xFF0000 WA, 0x0706
; set program address ; set program data
ld ld ld ld
(0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0xA0 (XIX), WA
;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle ;4th Bus Write Cycle
cal
TOGGLECHK
; check toggle bit
ld cp j ld cp j
BC, (XIX) WA, BC ne, PROGRAM _ ERR BC, (XIX) WA, BC ne, PROGRAM _ ERR
; read data from flash memory
; if programmed data cannot be read, error is determined ; read data from flash memory
; if programmed data cannot be read, error is determined
PROGRAM _ END: j PROGRAM _ END ; program operation end
Page 242
2007-10-10
TMP91FU62
;#### Toggle bit (D6) check processing #### TOGGLECHK: ld and ld L, (XIX) L, 0y01000000 H, L ; check toggle bit (D6) ; save first toggle bit data
TOGGLECHK1: ld and cp j ld j L, (XIX) L, 0y01000000 L, H z, TOGGLECHK2 H, L TOGGLECHK1 ; check toggle bit (D6) ; toggle bit = toggled? ; If not toggled, end processing ; save current toggle bit state ; Recheck toggle bit
TOGGLECHK2: ret
;#### Error processing #### SECTORERASE _ ERR: j SECTORERASE _ ERR ; sector erase error
PROGRAM _ ERR: j PROGRAM _ ERR ; program error
Page 243
2007-10-10
TMP91FU62
(Example: Program to be loaded and executed in RAM) Set read protection and write protection on the flash memory.
;#### Flash Memory Protect Set processing #### ld PROTECT: ld ld ld ld (0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0xA5 (XIX), 0x00 ;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle ;4th Bus Write Cycle XIX, 0xFE877E ; set protect address
cal cal ld cal cp j
TOGGLECHK PID _ ENTRY A, (XIX) PID _ EXIT A, 0x00 ne, PROTECT _ ERR
; check toggle bit ; ; read protected address ; ;(0xFE877E)=0x00? ; protected?
PROTECT _ END: j PROTECT _ END ; protect set operation completed
PROTECT _ ERR: j PROTECT _ ERR ; protect set error
;#### Product ID Entry processing #### PID _ ENTRY: ld ld ld (0xFE8AAA), 0xAA (0xFE8554), 0x55 (0xFE8AAA), 0x90 ;1st Bus Write Cycle ;2nd Bus Write Cycle ;3rd Bus Write Cycle
; --- wait for 300 nsec or longer (execute NOP instruction [200nsec/@fFPH=20MHz] two times) --nop nop ret
; wait for 400 nsec
;#### Product ID Exit processing #### PID _ EXIT: ld (0xFE8000), 0xF0 ;1st Bus Write Cycle
; --- wait for 300 nsec or longer (execute NOP instruction [200nsec/@fFPH=20MHz] two times) --nop nop ret
; wait for 400 nsec
Page 244
2007-10-10
TMP91FU62
;#### Toggle bit (D6) check processing #### TOGGLECHK: ld and ld L, (XIX) L, 0y01000000 H, L ; check toggle bit (D6) ; save first toggle bit data
TOGGLECHK1: ld and cp j ld j L, (XIX) L, 0y01000000 L, H z, TOGGLECHK2 H, L TOGGLECHK1 ; check toggle bit (D6) ; toggle bit = toggled? ; if not toggled, end processing ; save current toggle bit state ; recheck toggle bit
TOGGLECHK2: ret
(Example: Program to be loaded and executed in RAM)
Read data from address FE8000H.
;#### Flash memory read processing #### READ: ld WA, (0xFE8000) ; read data from flash memory
Page 245
2007-10-10
TMP91FU62
14. Electrical Characteristics
14.1 Absolute Maximum Ratings
Parameter Supply voltage Input voltage Output current (Per pin) Output current (Per pin) Output current (Per pin) Output current (Per pin) Output current (Per pin) Output current (Per pin) Output current (Total) Symbol VCC VIN IOL1 IOL2 IOL3 IOH1 IOH2 IOH3 IOL IOH IOL3 IOH3 PD TSOLDER TSTG TOPR P5, P6, P96, P97 P1, P3, P4, P7, P8, P90-P95, PA, PB P0 P5, P6, P96, P97 P1, P3, P4, P7, P8, P90-P95, PA, PB P0 P1, P3, P4, P5, P6, P7, P8, P9, PA, PB P1, P3, P4, P5, P6, P7, P8, P9, PA, PB P0 P0 Pin name Rating -0.5 to 6.0 -0.5 to VCC + 0.5 2 5 30 -2 -5 -30 80 -80 120 -120 600 260 -65 to 150 -40 to 85 Unit V V mA mA mA mA mA mA mA
Output current (Total) Output current (High current port Total) Output current (High current port Total) Power dissipation (TOPR = 85C) Soldering temperature (10 s) Storage temperature Operating temperature
mA mA mA mW C C C
Note: Absolute Maximum ratings are limiting values of operating and environmental conditions which should not be exceeded under the worst possible conditions. The equipment manufacturer should design so that no absolute maximum rating value is exceeded. Exposure to conditions beyond those listed above may cause permanent damage to the device or affect device reliability, which could increase potential risks of personal injury due to IC blowup and/or burning.
Solderability of lead free products Test Parameter Test Condition Use of Sn-37Pb solder Bath Solder bath temperature 230 C, Dipping time 5 [s] The number of times One, Use of R-type flux Solderability Use of Sn-3.0Ag-0.5 Cu solder Bath Solder bath temperature 245C, Dipping time 5 [s] The number of times One, Use of R-type flux (use of lead free) Note
Pass: solderability rate until forming
95%
Page 246
2007-10-10
TMP91FU62
14.2 DC Electrical Characteristics
Parameter (AVCC = DVCC) (AVSS = DVSS = 0V) Power supply voltage for erase/program operations of flash memory (AVCC = DVCC) (AVSS = DVSS = 0V) P00 to P17 Low-level input voltage RESET, P30 to PB2 AM0, AM1 X1 P00 to P17 High-level input voltage RESET, P30 to PB2 AM0, AM1 X1 Low-level output voltage VIL VIL1 VIL2 VIL3 VIH VIH2 VIH3 VIH4 VOL IOL = 1.6 mA (VCC = 4.5 to 5.5 V) IOH = -400 A High-level output voltage VOH (VCC = 4.5 to 5.5 V) IOH = -1.6 mA (VCC = 4.5 to 5.5 V) Low-level output current High current port P0 IOL ILI ILO VSTOP RRST CIO VTH RKH VOL = 1.0V (VCC = 4.5 to 5.5 V) 0.0 VIN VCC 0.2 VIN VCC - 0.2 VIL2 = 0.2 VCC VIH2 = 0.8 VCC VCC = 4.5 to 5.5 V fc = 1 MHz VCC = 4.5 to 5.5 V VCC = 4.5 to 5.5 V VCC = 4.5 to 5.5 V fc = 20 MHz VCC = 4.5 to 5.5 V ICC fs = 32.768 kHz TOPR 50C STOP TOPR 70C TOPR 85C Peak current for Intermittent operation (Note 3,4) IDDP-P VDD = 5.5 V - 20 VCC = 4.5 to 5.5 V 0.5 0.4 50 25 8 3.5 80 1.0 230 35 15 8 100 10 25 50 - mA A A mA 2.0 50 4.2 V 2.4 VCC = 4.5 to 5.5 V 2.2 0.75 VCC VCC - 0.3 0.8 VCC 0.45 V VCC + 0.3 V VCC = 4.5 to 5.5 V -0.3 0.8 0.25 VCC V 0.3 0.2 VCC VCC Symbol Condition fc = 4 to 20 MHz fs = 30 to 34 kHz fc = 4 to 20 MHz TOPR = -10 to 40 C Min 4.5 Typ. Max 5.5 V 4.75 5.25 Unit
20 5 10 5.5 230 10
mA
Input leakage current Output leakage current Power down voltage (while RAM is being backed up in STOP mode) RESET pull-up resistor Pin capacitance Schmitt width RESET, INT0 Programmable pull-up resistor NORMAL (Note 2) IDLE2 IDLE1 SLOW (Note 2)
0.02 0.05
A
V k pF V k
Note 1: Typical values show those at TOPR = 25C and VCC = 5 V. Note 2: ICC measurement conditions (NORMAL, SLOW): All functions are operational; output pins are open and input pins are level fixed. Data and address bus CL = 30 pF loaded. Note 3: When a program is executing in the flash memory or when data is being read from the flash memory, the flash memory operates in an intermittent manner, causing peak currents in the operation current, as shown in Figure 14-1. In this case, the supply current ICC (in NORMAL and SLOW modes) is defined as the sum of the average peak current and MCU current.
Page 247
2007-10-10
TMP91FU62
Note 4: When designing the power supply, make sure that peak currents can be supplied. In SLOW1 mode, the difference between the peak current and the average current becomes large.
1 machine cycle (4/fc or 4/fs) Program coutner (PC) I DDP-P
[mA]
n
n+1
n+2
n+3 Momentary flash current Sum of average momentary flash current and MCU current
Max. current Typ. current MCU current
Figure 14-1 Intermittent Operation of Flash Memory
Page 248
2007-10-10
TMP91FU62
14.3 AD Conversion Characteristics
AVCC = DVCC, AVSS = DVSS Parameter Analog reference voltage (+) Analog reference voltage (-) Analog input voltage range Error (Not including quantizing errors) Symbol AVCC AVSS VAIN VCC = 4.5 to 5.5 V Variable Min DVCC - 1.5 V DVSS AVSS 1.0 Typ. DVCC DVSS Max DVCC DVSS + 0.2 V AVCC 4.0 Unit V V V LSB
-
Note 1: 1LSB = (AVCC - AVSS)/1024 [V] Note 2: The operation above is guaranteed for fFPH 4 MHz. Note 3: The value for ICC includes the current which flows through the AVCC pin.
Page 249
2007-10-10
TMP91FU62
14.4 Serial Channel Timing (I/O internal mode)
14.4.1 SCLK input mode
Variable Parameter SCLK period Output data SCLK rising/falling edge* SCLK rising/falling edge* Output data hold SCLK rising/falling edge* Input data hold SCLK rising/falling edge* Valid data input* Valid data input SCLK rising/falling edge* Symbol Min tSCY tOSS tOHS tHSR tSRD tRDS 0 16x tSCY/2 - 4x -85 (VCC = 5V 10%) tSCY/2 + 2x + 0 3x + 10 tSCY - 0 0 Max
20 MHz Min 800 115 500 160 800 0 Max
16 MHz Unit Min 1000 165 625 198 1000 Max ns ns ns ns ns ns
Note: Symbol "x" in the above table means the period of clock "fFPH", it's half period of the system clock "fSYS" for CPU core. The period of fFPH depends on the clock gear setting or the selection of high-/low-oscillator frequency.
14.4.2 SCLK output mode
Variable Parameter SCLK period Output data SCLK rising/falling edge* SCLK rising/falling edge* Output data hold SCLK rising/falling edge* Input data hold SCLK rising/falling edge* Valid data input Valid data input SCLK rising/falling edge* Symbol Min tSCY tOSS tOHS tHSR tSRD tRDS 1x + 90 16x tSCY/2 - 40 tSCY/2 - 40 0 tSCY - 1x - 90 Max 8192x
20 MHz Min 0.8 360 360 0 660 Max 410
16 MHz Unit Min 1.0 460 460 0 847 Max 512 s ns ns ns ns
140
153
ns
Note 1: *: SCLK rising/falling edge:The rising edge is used in SCLK rising mode. The falling edge is used in SCLK falling mode. Note 2: 20 MHz and 16 MHz values are calculated from tSCY = 16x case. Note 3: Symbol "x" in the above table means the period of clock "fFPH", it's half period of the system clock "fSYS" for CPU core. The period of fFPH depends on the clock gear setting or the selection of high-/low-oscillator frequency.
tSCY
SCLK (rising edge) SCLK (falling edge)
tOSS Output data TXD Input data RXD 0
tOHS 1 tSRD 0
tRDS tHSR
2
3
1 Valid
2 Valid
3 Valid
Valid
Page 250
2007-10-10
TMP91FU62
14.5 Event Counter
TA0IN, TA4IN, TB0IN0, TB0IN1, TB1IN0,TB1IN1, TB2IN0,TB2IN1, TB3IN0,TB3IN1
Variable Parameter Clock period Clock low-level width Clock high-level width Symbol Min tVCK tVCKL tVCKH 8x + 100 4x + 40 4x + 40 Max
20 MHz Min 500 240 240 Max
16 MHz Unit Min 600 290 290 Max ns ns ns
Note: Symbol "x" in the above table means the period of clock "fFPH", it's half period of the system clock "fSYS" for CPU core. The period of fFPH depends on the clock gear setting or the selection of high-/low-oscillator frequency.
Page 251
2007-10-10
TMP91FU62
14.6 Interrupt and Capture
14.6.1 INT0 to INT4 interrupts
Variable Parameter INT0 to INT4 low-level width INT0 to INT4 high-level width Symbol Min tINTAL tINTAH 4x + 40 4x + 40 Max
20 MHz Min 240 240 Max
16 MHz Unit Min 290 290 Max ns ns
Note: Symbol "x" in the above table means the period of clock "fFPH", it's half period of the system clock "fSYS" for CPU core. The period of fFPH depends on the clock gear setting or the selection of high-/low-oscillator frequency.
14.6.2 INT1 to INT8 interrupts, capture
INT1 to INT8 input pulse width depend on the system clock selection and clock selection for prescaler. Below table show pulse width of each operation clock.
System Clock Selection SYSCR1
tINTBL Clock Selection for Prescaler SYSCR0 (INT1 to INT8 low level pulse width) Variable Min 0 (fFPH) 8x + 100 128xc + 0.1 8x + 0.1 fFPH = 20MHz Min 500 6.5 244.3
tINTBH (INT1 to INT8 high level pulse width) Variable Min 8x + 100 128xc + 0.1 8x + 0.1 fFPH = 20 MHz Min 500 6.5 us 244.3 ns Unit
0 (fc) 1 (fc/16) 1 (fc) 0 (fFPH)
Note 1: "xc" shows period of clock fc in high frequency oscillator. Note 2: Symbol "x" in the above table means the period of clock "fFPH", it's half period of the system clock "fSYS" for CPU core. The period of fFPH depends on the clock gear setting or the selection of high-/low-oscillator frequency.
Page 252
2007-10-10
TMP91FU62
14.7 SCOUT Pin AC Characteristics
Variable Parameter Low-level width High-level width Symbol Min tSCH tSCL 0.5T - 15 0.5T - 15 Max Min 10 10 Max Min 16 16 Max VCC 4.5V VCC 4.5V ns ns 20 MHz 16 MHz Condition Unit
Note: T = Period of SCOUT Measuring conditions Output level: High = 0.7 VCC, Low = 0.3 VCC, CL = 10 pF
tSCH SCOUT
tSCL
14.8 Flash Characteristics
14.8.1 Write/Retention Characteristics
(VSS = 0 V) Parameter VSS = 0 V Number of guaranteed writes to flash memory fc = 4 to 20 MHz TOPR = -10 to 40C Condition Min Typ. Max. Unit
-
-
100
Times
Page 253
2007-10-10
TMP91FU62
14.9 Recommended Oscillating Conditions
The TMP91FU62 has been evaluated by the oscillator vender below. Use this information when selecting external parts.
X1 X2 XT1 XT2
Rd C1 C2 C1
Rd
C2
(1) High-frequency Oscillation
(2) Low-frequency Oscillation
Note 1: To ensure stable oscillation, the resonator position, load capacitance, etc. must be appropriate. Because these factors are greatly affected by board patterns, please be sure to evaluate operation on the board on which the device will actually be mounted. Note 2: When using the device (oscillator) in places exposed to high electric fields such as cathode-ray tubes, we recommend electrically shielding the package in order to maintain normal operating condition. Note 3: The product numbers and specifications of the resonators by Murata Manufacturing Co., Ltd. are subject to change. For up-to-date information, please refer to the following URL: http://www.murata.co.jp/search/index.html
Page 254
2007-10-10
TMP91FU62
15. Table of SFR's
The special function registers (SFRs) include the I/O ports and peripheral control registers allocated to the 4-Kbyte address space from 000000H to 000FFFH. 1. I/O ports 2. I/O port control 3. Interrupt control 4. Clock gear 5. 8-bit timer 6. 16-bit timer 7. UART/serial channel 8. I2C bus interface 9. AD converter 10. Watchdog timer 11. Special timer for CLOCK 12. Program patch logic
Page 255
2007-10-10
TMP91FU62
Table 15-1 SFR Address Map (PORT, INTC, CS/WAIT)
[1]PORT Address Name Address Name Address Name
0000H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
P0 P1 P0CR P1CR
P3 P3FC2 P3CR P3FC
0010H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
P4 P4FC2 P4CR P5
SIOCHG1
P5CR P5FC P6 P6CR P6FC P7 P7CR P7FC
0020H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
P8 P8CR P8FC P9
SIOCHG0
P9CR P9FC PA PACR PAFC PB PBCR
[2]INTC Address Name Address Name
[2]INTC Address Name
0030H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH ODE
0080H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
DMA0V DMA1V DMA2V DMA3V
INTCLR DMAR DMAB IIMC
0090H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
INTE0AD INTE12 INTE34 INTE56 INTE78 INTETA01 INTETA45 INTETB0 INTETB1 INTETB2 INTETB3 INTETB01V INTETB23V
[4] CGEAR Address Name Address Name
00A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
INTERTC INTES0 INTES1 INTES2 INTESBI0 INTETC01 INTETC23
00E0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
SYSCR0 SYSCR1 SYSCR2 EMCCR0 EMCCR1
Note: Do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
Page 256
2007-10-10
TMP91FU62
Table 15-2 SFR Address Map (CGCR, TMRA, TMRB)
[5] TMRA Address Name Address Name [6] TMRB Address Name
0100H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TA01RUN TA0REG TA1REG TA01MOD TA1FFCR
0110H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TA45RUN TA4REG TA5REG TA45MOD TA5FFCR
0180H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TB0RUN TB0MOD TB0FFCR
TB0RG0L TB0RG0H TB0RG1L TB0RG1H TB0CP0L TB0CP0H TB0CP1L TB0CP1H
[6] TMRB Address Name Address Name Address Name
0190H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TB1RUN TB1MOD TB1FFCR
TB1RG0L TB1RG0H TB1RG1L TB1RG1H TB1CP0L TB1CP0H TB1CP1L TB1CP1H
01A0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TB2RUN TB2MOD TB2FFCR
TB2RG0L TB2RG0H TB2RG1L TB2RG1H TB2CP0L TB2CP0H TB2CP1L TB2CP1H
01B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
TB3RUN TB3MOD TB3FFCR
TB3RG0L TB3RG0H TB3RG1L TB3RG1H TB3CP0L TB3CP0H TB3CP1L TB3CP1H
[7] UART/SIO Address Name Address Name
[8] I2C Address Name
0200H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
SC0BUF SC0CR SC0MOD0 BR0CR BR0ADD SC0MOD1
SC1BUF SC1CR SC1MOD0 BR1CR BR1ADD SC1MOD1
0210H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
SC2BUF SC2CR SC2MOD0 BR2CR BR2ADD SC2MOD1
0240H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
SBI0CR1 SBI0DBR I2C0AR SBI0CR2/SBI0SR SBI0BR
SBI0CR0
Note: Do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
Page 257
2007-10-10
TMP91FU62
Table 15-3 SFR Address Map (UART/SIO, I2C, ADC, WDT, RTC, ROMC)
[9]10bit ADC Address Name [10] WDT Address Name [11] RTC Address Name
02B0H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
ADCCR1 ADCCR2 ADCDRL ADCDRH
0300H WDMOD 1H WDCR 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
0310H RTCCR 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
[12] ROMC Address Name Address Name Address Name
0400H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
ROMCMP00 ROMCMP01 ROMCMP02 ROMSUB0L ROMSUB0H
ROMCMP10 ROMCMP11 ROMCMP12 ROMSUB1L ROMSUB1H
0410H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
ROMCMP20 ROMCMP21 ROMCMP22 ROMSUB2L ROMSUB2H
ROMCMP30 ROMCMP31 ROMCMP32 ROMSUB3L ROMSUB3H
0420H 1H 2H 3H 4H 5H 6H 7H 8H 9H AH BH CH DH EH FH
ROMCMP40 ROMCMP41 ROMCMP42 ROMSUB4L ROMSUB4H
ROMCMP50 ROMCMP51 ROMCMP52 ROMSUB5L ROMSUB5H
Note: Do not access to the unnamed addresses (e.g., addresses to which no register has been allocated).
Page 258
2007-10-10
TMP91FU62
(1)
I/O Ports
Symbol Name Address 7 P07 P0 Port 0 00H 6 P06 5 P05 4 P04 R/W Data from external port (Output latch register is undefined.) P17 P1 Port 1 01H P16 P15 P14 R/W Data from external port (Output latch register is cleared to "0".) - P3 Port 3 0CH - - - - - - - - - - - - - - - P43 P33 P32 R/W Data from external port (Output latch register is set to "1".) P42 R/W P4 Port 4 10H - - - - Data from external port (Output latch register is set to "1".) 0 (Output latch register): Pull-up resistor OFF 1 (Output latch register): Pull-up resistor ON P53 R/W Data from external port (Output latch register is set to "1".) P67 P6 Port 6 18H P66 P65 P64 R/W Data from external port (Output latch register is set to "1".) - P7 Port 7 1CH - - P87 P8 Port 8 20H - - - P86 P85 P75 P74 P73 - Data from external port (Output latch register is set to "1".) P84 R/W Data from external port (Output latch register is set to "1".) P97 P9 Port 9 24H P96 P95 P94 R/W Data from external port (Output latch register is set to "1".) - PA Port A 28H - - - PB Port B 2CH - - - - - - - - - - - - - - - - - - - - - - - PA3 PA2 R/W Data from external port (Output latch register is set to "1".) PB2 PB1 R/W Data from external port (Output latch register is set to "1".) PB0 PA1 PA0 P93 P92 P91 P90 P83 P82 P81 P80 P72 P71 P70 P63 P62 P61 P60 P52 P51 P50 P41 P40 P31 P30 P13 P12 P11 P10 3 P03 2 P02 1 P01 0 P00
- P57 P5 Port 5 14H
- P56
- P55
- P54
Page 259
2007-10-10
TMP91FU62
(2) I/O Port control
Symbol Name Address 02H P0CR Port 0 control
(RMW instructions are prohibited.)
7 P07C
6 P06C
5 P05C
4 P04C W
3 P03C
2 P02C
1 P01C
0 P00C
0
0
0
0
0
0
0
0
0: Input 1: Output P17C 04H P1CR Port 1 control
(RMW instructions are prohibited.)
P16C
P15C
P14C W
P13C
P12C
P11C
P10C
0
0
0
0
0
0
0
0
0: Input 1: Output - 0EH P3CR Port 3 control
(RMW instructions are prohibited.)
- - - - - - -
- - - - - - -
- - - - - - -
P33C
P32C W
P31C
P30C
- - - - - -
0
0
0
0
<> P33F P32F W 0 P33F/ P33C= 00:input 0 P32F/ P32C= 00:input port 01:output port 10: reserv ed 11:TB3OUT0 - - -
<> P31F P30F
0
0
0FH P3FC Port 3 function
(RMW instructions are prohibited.)
-
-
-
-
port 01:output port 10: reserv ed 11:TB3OUT1
<>
- - -
- - -
- - -
- - -
- - -
P31F2 W 0 P31F2/ P31F/ P31C= 000:input
P30F2
0 P30F2/ P30F/ P30C= 000:input port 001:output port 010:TB3IN0 /INT3 101: SDA0
0DH P3FC2 Port 3 function 2
(RMW instructions are prohibited.)
-
-
-
-
-
-
port 001:output port 010:TB3IN1 /INT4 101: SCL0
Page 260
2007-10-10
TMP91FU62
Symbol
Name
Address 12H
7 -
6 - - - - - - -
5 - - - - - - -
4 P44C
3 P43C
2 P42C W
1 P41C
0 P40C
P4CR
Port 4 control
(RMW instructions are prohibited.)
- - - - - -
0
0
0
0
0
<> - - - P43F2 W 0
P43F2, P43C = 00 :input
- - -
P42C = 0: input
P41F2 W 0
P41F2, P41C = 00: input
P40F2
0
P40F2, P40C = 00: input port 01:output port 10: reserved 11: SCOUT
11H P4FC2 Port 4 function 2
(RMW instructions are prohibited.)
-
-
-
-
port
01:output
port
1: output
port
01: output port 10: reserved 11:TXD2
port
10: reserved 11:SCLK2
port
- - SIO change register 1 15H
(RMW instructions are prohibited.)
- - -
- - -
SIOCHG14
- - -
SIOCHG12
SIOCHG11
- -
W 0 P42 port 0: CMOS output 1: Opendrain output P54C W
W 0 0 0: Setting of P41F2 and P41C 1: RXD2 P51C
-
-
SIOCHG1
-
-
-
-
0: Setting of P42C 1: TXD2
-
P57C 16H P5CR Port 5 control
(RMW instructions are prohibited.)
P56C
P55C
P53C
P52C
P50C
0
0
0
0
0
0
0
0
0: Input 1: Output P57F 17H P5FC Port 5 function
(RMW instructions are prohibited.)
P56F
P55F
P54F W
P53F
P52F
P51F
P50F
0 P57 input 0: disable 1: enable P67C
0 P56 input 0: disable 1: enable P66C
0 P55 input 0: disable 1: enable P65C
0 P54 input 0: disable 1: enable P64C W
0 P53 input 0: disable 1: enable P63C
0 P52 input 0: disable 1: enable P62C
0 P51 input 0: disable 1: enable P61C
0 P50 input 0: disable 1: enable P60C
1AH P6CR Port 6 control
(RMW instructions are prohibited.)
0
0
0
0
0
0
0
0
0: Input 1: Output P67F 1BH P6FC Port 6 function
(RMW instructions are prohibited.)
P66F
P65F
P64F W
P63F
P62F
P61F
P60F
0 P67 input 0: disable 1: enable -
0 P66 input 0: disable 1: enable - - - - - - - -
0 P65 input 0: disable 1: enable P75C
0 P64 input 0: disable 1: enable P74C
0 P63 input 0: disable 1: enable P73C W
0 P62 input 0: disable 1: enable P72C
0 P61 input 0: disable 1: enable P71C
0 P60 input 0: disable 1: enable P70C
1EH P7CR Port 7 control
(RMW instructions are prohibited.)
- - - -
0
0
0
0
0
0
0: Input 1: Output P75F W 0 0: Port 1: INT0 0 0: Port
1: TA5OUT
P74F
- - - -
- - - -
P71F W 0 0: Port
1: TA1OUT
- - - -
1FH P7FC Port 7 function
(RMW instructions are prohibited.)
- - -
Page 261
2007-10-10
TMP91FU62
Symbol
Name
Address 22H
7 P87C
6 P86C
5 P85C
4 P84C W
3 P83C
2 P82C
1 P81C
0 P80C
P8CR
Port 8 control
(RMW instructions are prohibited.)
0
0
0
0
0
0
0
0
0: Input 1: Output P87F 23H P8FC Port 8 function
(RMW instructions are prohibited.)
P86F
P85F
P84F W
P83F
P82F
P81F
P80F
0 0: port
1: TB1OUT1
0 0: port 1: TB1OUT0 - - -
0 0: port
1: TB1IN1, INT8
0 0: port
1: TB1IN0, INT7
0 0: port 1: TB0OUT1
SIOCHG03
0 0: port 1: TB0OUT0
SIOCHG02
0 0: port
1: TB0IN1, INT6
0 0: port
1: TB0IN0, INT5
- - SIO change register 0 25H
(RMW instructions are prohibited.)
SIOCHG05
SIOCHG04
SIOCHG01
SIOCHG00
W 0 P94 port 0: CMOS output 1: Opendrain output P95C 0 0 0: Setting of P93F and P93C 1: RXD1 P93C W 0 P91 port 0: CMOS output 1: Opendrain output P92C 0 0 0: Setting of P90F and P90C 1: RXD0 P90C
-
SIOCHG0
-
-
0: Setting of P94C 1: TXD1
0: Setting of P91C 1: TXD0
P97C 26H P9CR Port 9 control
(RMW instructions are prohibited.)
P96C
P94C
P91C
1
1
0
0
0
0
0
0
0: Input 1: Output P97F 27H P9FC Port 9 function
(RMW instructions are prohibited.)
P96F W
P95F
- -
P93F W 0 0: port 1: TXD1 output
P92F
- -
P90F W 0 0: port 1: TXD0 output
0 Port 0: disable 1: enable -
0 Port 0: disable 1: enable - - - - - - -
0 0: port 1: SCLK1 output - - - - - - -
-
0 0: port 1: SCLK0 output PA2C W
-
-
-
- - - - - - -
PA3C
PA1C
PA0C
2AH PACR Port A control
(RMW instructions are prohibited.)
- - - -
0
0
0
0
0: Input 1: Output PA3F PA2F W 0 0: port 1: TB2OUT1 - - - - ODE90 ODE41 R/W 0 0 0:port 1: TB2OUT0 PB2C 0 0: port 1: TB2IN1, INT2 PB1C W 0 0: Input 1: Output ODE31 ODE30 0 0 0: port 1: TB2IN0, INT1 PB0C PA1F PA0F
2BH PAFC Port A function
(RMW instructions are prohibited.)
- -
-
-
-
-
- 2EH PBCR Port B control
(RMW instructions are prohibited.)
- - - - - - - -
- - - - - - - -
- - - - ODE93
- - - -
ODE
Open-drain control register
- 3FH - -
0
0
0
0
0
0: CMOS output 1:Open drain output
Page 262
2007-10-10
TMP91FU62
(3) Interrupt control
Symbol Name Address 7 6 INTAD Interrupt enable 0 & AD IADC 90H R 0 1: INTAD 0 IADM2 IADM1 R/W 0 Interrput level INT2 Interrupt enable 2/1 I2C 91H R 0 1: INT2 0 I2M2 I2M1 R/W 0 Interrput level INT4 Interrupt enable 4/3 I4C 92H R 0 1: INT4 0 I4M2 I4M1 R/W 0 Interrput level INT6 Interrupt enable 6/5 I6C 93H R 0 1: INT6 0 I6M2 I6M1 R/W 0 Interrput level INT8 Interrupt enable 8/7 I8C 94H R 0 1: INT8 0 I8M2 I8M1 R/W 0 Interrput level INTTA1(TMRA1) Interrupt enable timer A 1/0 ITA1C 96H R 0 1: INTTA1 0 ITA1M2 ITA1M1 R/W 0 Interrput level INTTA5 (TMRA5) Interrupt enable timer A 5/4 ITA5C 98H R 0 1: INTTA5 0 ITA5M2 ITA5M1 R/W 0 Interrput level 0 ITA5M0 ITA4C R 0 1: INTTA4 0 0 ITA1M0 ITA0C R 0 1: INTTA0 0 0 I8M0 I7C R 0 1: INT7 0 I7M2 0 I6M0 I5C R 0 1: INT5 0 I5M2 0 I4M0 I3C R 0 1: INT3 0 I3M2 0 I2M0 I1C R 0 1: INT1 0 I1M2 0 IADM0 I0C R 0 1: INT0 0 I0M2 5 4 3 2 INT0 I0M1 R/W 0 Interrput level INT1 I1M1 R/W 0 Interrput level INT3 I3M1 R/W 0 Interrput level INT5 I5M1 R/W 0 Interrput level INT7 I7M1 R/W 0 Interrput level INTTA0 (TMRA0) ITA0M2 ITA0M1 R/W 0 Interrput level INTTA4 (TMRA4) ITA4M2 ITA4M1 R/W 0 Interrput level 0 ITA4M0 0 ITA0M0 0 I7M0 0 I5M0 0 I3M0 0 I1M0 0 I0M0 1 0
INTE0AD
INTE12
INTE34
INTE56
INTE78
INTETA01
INTETA45
Page 263
2007-10-10
TMP91FU62
Symbol
Name
Address
7
6
5
4
3
2
1
0
INTTB01(TMRB0) Interrupt enable TMRB 0 ITB01C 99H R 0
1: INTTB01
INTTB00(TMRB0) ITB01M0 ITB00C R 0 0
1: INTTB00
ITB01M2
ITB01M1 R/W
ITB00M2
ITB00M1 R/W
ITB00M0
INTETB0
0
0 Interrput level
0
0 Interrput level
0
INTTB11(TMRB1) Interrupt enable TMRB 1 ITB11C 9AH R 0
1: INTTB11
INTTB10(TMRB1) ITB11M0 ITB10C R 0 0
1: INTTB10
ITB11M2
ITB11M1 R/W
ITB10M2
ITB10M1 R/W
ITB10M0
INTETB1
0
0 Interrput level
0
0 Interrput level
0
INTTB21(TMRB2) Interrupt enable TMRB 2 ITB21C 9BH R 0
1: INTTB21
INTTB20(TMRB2) ITB21M0 ITB20C R 0 0
1: INTTB20
ITB21M2
ITB21M1 R/W
ITB20M2
ITB20M1 R/W
ITB20M0
INTETB2
0
0 Interrput level
0
0 Interrput level
0
INTTB31(TMRB3) Interrupt enable TMRB 3 ITB31C 9CH R 0
1: INTTB31
INTTB30(TMRB3) ITB31M0 ITB30C R 0 0
1: INTTB30
ITB31M2
ITB31M1 R/W
ITB30M2
ITB30M1 R/W
ITB30M0
INTETB3
0
0 Interrput level
0
0 Interrput level
0
INTTBOF1(TMRB1 over flow) Interrupt enable TMRB 0/1 (Over flow) ITF1C 9EH R 0
1: INTTBOF1
INTTBOF1(TMRB0 over flow) ITF1M0 ITF0C R 0 0
1:INTTBOF0
ITF1M2
ITF1M1 R/W
ITF0M2
ITF0M1 R/W
ITF0M0
INTETB01V
0
0 Interrput level
0
0 Interrput level
0
INTTBOF3(TMRB3 over flow) Interrupt enable TMRB 2/3 (Over flow) ITF3C 9FH R 0
1: INTTBOF3
INTTBOF2(TMRB2 over flow) ITF3M0 ITF2C R 0 0
1:INTTBOF2
ITF3M2
ITF3M1 R/W
ITF2M2
ITF2M1 R/W
ITF2M0
INTETB23V
0
0 Interrput level
0
0 Interrput level
0
Page 264
2007-10-10
TMP91FU62
Symbol
Name
Address
7
6 INTRTC
5
4
3
2
1
0
-
IRTCM0 R/W
INTERTC
Interrupt enable INTRTC
IRTCC A0H R 0 1: INTRTC
IRTCM2
IRTCM1
0
0 Interrput level INTTX0
0
- - - -
IRX0C R
- -
INTRX0
- - - -
IRX0M1 R/W
- -
INTES0
Interrupt enable serial 0
ITX0C A1H R 0 1: INTTX0
ITX0M2
ITX0M1 R/W
ITX0M0
IRX0M2
IRX0M0
0
0 Interrput level INTTX1
0
0 1: INTRX0
0
0 Interrput level INTRX1
0
INTES1
Interrupt enable serial 1
ITX1C A2H R 0 1: INTTX1
ITX1M2
ITX1M1 R/W
ITX1M0
IRX1C R
IRX1M2
IRX1M1 R/W
IRX1M0
0
0 Interrput level INTTX2
0
0 1: INTRX1
0
0 Interrput level INTRX2
0
INTES2
Interrupt enable serial 2
ITX2C A3H R 0 1: INTTX2
ITX2M2
ITX2M1 R/W
ITX2M0
IRX0C R
IRX2M2
IRX2M1 R/W
IRX2M0
0
0 Interrput level
0
0 1: INTRX2
0
0 Interrput level INTSBI0
0
-
INTESBI0 Interrupt enable SBI 0/1 A4H
- - - -
ITC1C
- -
INTTC1
- - - -
ITC1M1 R/W
- -
ISBI0C R 0 1: INTSBI0
ISBI0M2
ISBI0M1 R/W
ISBI0M0
0
0 Interrput level INTTC0
0
INTETC01
Interrupt enable TC 0/1
ITC1M2
ITC1M0
ITC0C R
ITC0M2
ITC0M1 R/W
ITC0M0
A5H
R 0
1: INTTC1
0
0 Interrput level INTTC3
0
0 1: INTTC0
0
0 Interrput level INTTC2
0
INTETC23
Interrupt enable TC 2/3
ITC3C A6H R 0
1: INTTC3
ITC3M2
ITC3M1 R/W
ITC3M0
ITC2C R
ITC2M2
ITC2M1 R/W
ITC2M0
0
0 Interrput level
0
0 1: INTTC2
0
0 Interrput level
0
Page 265
2007-10-10
TMP91FU62
Symbol
Name
Address
7
6
5 DMA0V5
4 DMA0V4
3 DMA0V3 R/W
2 DMA0V2
1 DMA0V1
0 DMA0V0
-
DMA0V DMA0 Start Vector 80H
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
0
0
0
0
0
0
0
DMA0 start vector DMA1V5 DMA1V4 DMA1V3 R/W 0 0 0 0 0 0 DMA1V2 DMA1V1 DMA1V0
DMA1V
DMA1 Start Vector
81H
DMA1 start vector DMA2V5 DMA2V4 DMA2V3 R/W 0 0 0 0 0 0 DMA2V2 DMA2V1 DMA2V0
DMA2V
DMA2 Start Vector
82H
DMA2 start vector DMA3V5 DMA3V4 DMA3V3 R/W 0 0 0 0 0 0 DMA3V2 DMA3V1 DMA3V0
DMA3V
DMA3 Start Vector
83H
DMA3 start vector CLRV5 CLRV4 CLRV3 W 0 0 0 0 0 0 CLRV2 CLRV1 CLRV0
INTCLR
Interrupt Clear Control
88H
(RMW instructions are prohibited.)
Interrupt vector
- - - - - - - - -
0
- - - - - - - - -
W 0
DMAR3
DMAR2 R/W
DMAR1
DMAR0
DMAR
DMA Software Request Register
89H
(RMW instructions are prohibited.)
0
0
0
0
1: DMA software request DMAB3 DMAB2 R/W 0 0 0 0 DMAB1 DMAB0
DMAB
DMA Burst Register
8AH
1: DMA burst request
-
0
I0EDGE
I0LE
-
0
IIMC
Interrupt input mode control
8CH
(RMW instructions are prohibited.)
0 INT0 EDGE 0: Rising 1: Falling
0 INT0 mode 0: Edge 1: Level
Always write "0".
-
-
-
-
-
Page 266
2007-10-10
TMP91FU62
(4) Clock control
Symbol Name Address 7 XEN 6 XTEN 5 RXEN 4 RXTEN R/W 1 0 1 0 0 0 Warm-up timer control 0 Write: Don't care 1 Write: Start warm-up 0 Read: End warmup 1 Read: Do not end warm-up GEAR2 R/W 0 0 0 0 0 3 RSYSCK 2 WUEF 1 PRCK1 0 - - -
SYSCR0
System clock control register 0
E0H
Highfrequency oscillator 0:Stop 1:Oscillation
Lowfrequency oscillator 0:Stop 1:Oscillation
Highfrequency oscillator (fc) after release of STOP mode 0:Stop 1:Oscillation
Lowfrequency oscillator (fs) after release of STOP mode 0:Stop 1:Oscillation
Selects clock after release of STOP mode 0:fc 1:fs
Select prescaler clock 0:fFPH 1:fc/16
-
- - - System clock control register 1
- - -
- - -
- - -
SYSCK
GEAR2
GEAR2
SYSCR1
E1H - - - -
Select system clock 0: fc 1: fs
Select gear value of high frequency (fc) 000:fc 001:fc/2 010:fc/4 011:fc/8 100:fc/16 101:reserved 110:reserved 111:reserved
- - - System clock control register 1
SCOSEL
WUPTM1
WUPTM0 R/W
HALTM1
HALTM0
- -
DRVE R/W 0 Pin state control in STOP mode 0: I/O off 1:Remains the state before HALT -
0
1
0
1
1
-
Select warm-up time for oscillator E2H - Select SCOUT 0:fs 1:fSYS 00:218/inputted frequency 01:28/inputted frequency 10:214/inputted frequency 11:216/inputted frequency PROTECT R - - - - R/W 0 1 0 0 0 1 - - HALT mode 00:reserved 01:STOP mode 10:IDLE1 mode 11:IDLE2 mode
SYSCR2
-
EMCCR0
EMC control register 0
0 E3H Protect flag 0:OFF 1:ON
1
Write "0".
Write "1".
Write "0".
Write "0".
Write "0".
Write "1".
Write "1".
EMCCR1
EMC control register 1
E4H
Protect OFF by writing "1FH". Protect ON by writing except "1FH".
Page 267
2007-10-10
TMP91FU62
(5) 8-bit timer
Symbol Name Address 7 TA0RDE R/W 8-bit timer RUN 0 100H Double buffer 0: Disable 1: Enable 6 - - - 5 - - - 4 - - - 0 IDLE2 0: Stop 1: Operate - W 0 - W 0 TA01M1 8-bit timer source CLK & mode TA01M0 PWM01 PWM00 TA1CLK1 R/W 0 104H 0 0 PWM cycle 00: Reserved 01: 26 10: 27 11: 28 - - - - - - 1 00: Invert TA1FF 01: Set TA1FF 10: Clear TA1FF 11: Don't care 1 0 0 0 0 0 TA1CLK0 TA0CLK1 TA0CLK0 0 TMRA01 prescaler 3 I2TA01 2
TA01PRUN
1 TA1RUN
0 TA0RUN
R/W 0 Up counter (UC1) 0 Up counter (UC0)
TA01RUN
-
-
-
0: Stop and clear 1: Run (count up)
TA0REG
8-bit timer register 0 8-bit timer register 1
102H
(RMW instructions are prohibited.)
103H
(RMW instructions are prohibited.)
TA1REG
TA01MOD
Operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit PPG mode 11: 8-bit PWM mode - - - - -
Input clock for TMRA1 00: TA0TRG 01: T1 10: T16 11: T256 TA1FFC1 TA1FFC0
Input clock for TMRA0 00: TA0IN pin 01: T1 10: T4 11: T16 TA1FFIE TA1FFIS
R/W 0 TA1FF control for inversion 0: Disable 1: Enable 0 TA1FF inversion select 0: TMRA0 1: TMRA1
TA1FFCR
8-bit timer frip-flop control
- 105H -
-
-
-
Page 268
2007-10-10
TMP91FU62
Symbol
Name
Address
7 TA4RDE R/W
6 - - -
5 - - -
4 - - -
3 I2TA45
2
TA45PRUN
1 TA5RUN
0 TA4RUN
R/W 0 IDLE2 0: Stop 1: Operate - W 0 - W 0 0 TMRA45 prescaler 0 Up counter (UC5) 0 Up counter (UC4)
TA45RUN
8-bit timer RUN
0 110H Double buffer 0: Disable 1: Enable
-
-
-
0: Stop and clear 1: Run (count up)
TA4REG
8-bit timer register 0 8-bit timer register 1
112H
(RMW instructions are prohibited.)
113H
(RMW instructions are prohibited.)
TA5REG
TA45M1 8-bit timer source CLK & mode
TA45M0
PWM41
PWM40
TA5CLK1 R/W
TA5CLK0
TA4CLK1
TA4CLK0
0 114H
0
0 PWM cycle 00: Reserved 01: 26 10: 27 11: 28 - - -
0
0
0
0
0
TA45MOD
Operation mode 00: 8-bit timer mode 01: 16-bit timer mode 10: 8-bit PPG mode 11: 8-bit PWM mode - - - - -
Input clock for TMRA5 00: TA4TRG 01: T1 10: T16 11: T256 - - - 1 00: Invert TA5FF 01: Set TA5FF 10: Clear TA5FF 11: Don't care 1 TA5FFC1 TA5FFC0
Input clock for TMRA4 00: TA4IN pin 01: T1 10: T4 11: T16 TA5FFIE TA5FFIS
R/W 0 TA5FF control for inversion 0: Disable 1: Enable 0 TA5FF inversion select 0: TMRA4 1: TMRA5
TA5FFCR
8-bit timer frip-flop control
- 115H -
-
-
-
Page 269
2007-10-10
TMP91FU62
(6) 16-bit timer
Symbol Name Address 7 TB0RDE R/W 16-bit timer control 0 180H Double Buffer 0: Disable 1: Enable TB0CT1 R/W 16-bit timer source CLK & mode 0 182H
(RMW instructions are prohibited.) Invert when UC0 is loaded into TB0CP1H/L Invert when UC0 matches with TB0RG1H/L
6 -
5 - -
4 - - -
3 I2TB0
2 TB0PRUN R/W
1 - -
0 TB0RUN R/W 0 Up counter (UC0)
0
-
0 IDLE2 0: Stop 1: Operate TB0CPM0
0 TMRB0 prescaler 0: Stop and Clear 1: Run (count up) TB0CLE R/W
- -
TB0RUN
Always write 0.
-
-
TB0ET1
TB0CP0I W*
TB0CPM1
TB0CLK1
TB0CLK0
0
1
Software capture control 0: Software capture 1: Undefined
0
0
0 Up counter control 0: Clear disable 1: Clear enable TB0E0T1
0
0
TB0MOD
TB0FF1 inversion trigger 0: Trigger disable 1: Trigger enable
Capture timing 00: Disable INT5 occurs at rising edge 01: TB0IN0 TB0IN1 INT5 occurs at rising edge 10: TB0IN0 TB0IN0 INT5 occurs at falling edge 11: TA1OUT TA1OUT INT5 occurs at rising edge
TMRB0 input clock select 00: TB0IN0 pin input 01: T1 10: T4 11: T16 TB0FF0C1 TB0FF0C0
TB0FF1C1
TB0FF1C0
TB0C1T1
TB0C0T1 R/W
TB0E1T1
W* 1 TB0FFCR 16-bit timer frip-flop control 183H
(RMW instructions are prohibited.)
W* 0 0 1 1
1
0
0
TB0FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB0FF0 inversion trigger 0: Disable 1: Enable
Invert when UC0 is loaded into TB0CP1H/L. Invert when UC0 is loaded into TB0CP0H/L. Invert when UC0 matches TB0RG1H/L. Invert when UC0 matches TB0RG0H/L.
TB0FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB0RG0L
16-bit timer register 0L 16-bit timer register 0H 16-bit timer register 1L 16-bit timer register 1H
188H
(RMW instructions are prohibited.)
- W Undefined - W Undefined - W Undefined - W Undefined -
189H
(RMW instructions are prohibited.)
TB0RG0H
18AH
(RMW instructions are prohibited.)
TB0RG1L
18BH
(RMW instructions are prohibited.)
TB0RG1H
TB0CP0L
Capture register 0L
18CH
R Undefined -
TB0CP0H
Capture register 0H
18DH
R Undefined -
TB0CP1L
Capture register 1L
18EH
R Undefined -
TB0CP1H
Capture register 1H
18FH
R Undefined
Page 270
2007-10-10
TMP91FU62
Symbol
Name
Address
7 TB1RDE R/W
6 -
5 - -
4 - - -
3 I2TB1
2 TB1PRUN R/W
1 - -
0 TB1RUN R/W 0 Up counter (UC1)
TB1RUN
16-bit timer control
0 190H Double Buffer 0: Disable 1: Enable TB1CT1 R/W
0
-
0 IDLE2 0: Stop 1: Operate TB1CPM0
0 TMRB1 prescaler 0: Stop and Clear 1: Run (count up) TB1CLE R/W
- -
Always write 0.
-
-
TB1ET1
TB1CP0I W*
TB1CPM1
TB1CLK1
TB1CLK0
TB1MOD
16-bit timer source CLK & mode
0 192H
(RMW instructions are prohibited.) Invert when UC1 is loaded into TB1CP1H/L
0
1
Software capture control 0: Software capture 1: Undefined
0
0
0 Up counter control 0: Clear disable 1: Clear enable TB1E0T1
0
0
TB1FF1 inversion trigger 0: Trigger disable 1: Trigger enable
Invert when UC1 matches with TB1RG1H/L
Capture timing 00: Disable INT7 occurs at rising edge 01: TB1IN0 TB1IN1 INT7 occurs at rising edge 10: TB1IN0 TB1IN0 INT7 occurs at falling edge 11: TA1OUT TA1OUT INT7 occurs at rising edge
TMRB1 input clock select 00: TB1IN0 pin input 01: T1 10: T4 11: T16 TB1FF0C1 TB1FF0C0
TB1FF1C1
TB1FF1C0
TB1C1T1
TB1C0T1 R/W
TB1E1T1
W* 1 TB1FFCR 16-bit timer frip-flop control 193H
(RMW instructions are prohibited.)
W* 0 0 1 1
1
0
0
TB1FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB1FF0 inversion trigger 0: Disable 1: Enable
Invert when UC1 is loaded into TB1CP1H/L. Invert when UC1 is loaded into TB1CP0H/L. Invert when UC1 matches TB1RG1H/L. Invert when UC1 matches TB1RG0H/L.
TB1FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB1RG0L
16-bit timer register 0L 16-bit timer register 0H 16-bit timer register 1L 16-bit timer register 1H
198H
(RMW instructions are prohibited.)
- W Undefined - W Undefined - W Undefined - W Undefined -
199H
(RMW instructions are prohibited.)
TB1RG0H
19AH
(RMW instructions are prohibited.)
TB1RG1L
19BH
(RMW instructions are prohibited.)
TB1RG1H
TB1CP0L
Capture register 0L
19CH
R Undefined -
TB1CP0H
Capture register 0H
19DH
R Undefined -
TB1CP1L
Capture register 1L
19EH
R Undefined -
TB1CP1H
Capture register 1H
19FH
R Undefined
Page 271
2007-10-10
TMP91FU62
Symbol
Name
Address
7 TB2RDE R/W
6 -
5 - -
4 - - -
3 I2TB2
2 TB2PRUN R/W
1 - -
0 TB2RUN R/W 0 Up counter (UC2)
TB2RUN
16-bit timer control
0 1A0H Double Buffer 0: Disable 1: Enable TB2CT1 R/W
0
-
0 IDLE2 0: Stop 1: Operate TB2CPM0
0 TMRB2 prescaler 0: Stop and Clear 1: Run (count up) TB2CLE R/W
- -
Always write 0.
-
-
TB2ET1
TB2CP0I W*
TB2CPM1
TB2CLK1
TB2CLK0
TB2MOD
16-bit timer source CLK & mode
0 1A2H
(RMW instructions are prohibited.) Invert when UC2 is loaded into TB2CP1H/L
0
1
Software capture control 0: Software capture 1: Undefined
0
0
0 Up counter control 0: Clear disable 1: Clear enable TB2E0T1
0
0
TB2FF1 inversion trigger 0: Trigger disable 1: Trigger enable
Invert when UC2 matches with TB2RG1H/L
Capture timing 00: Disable INT1 occurs at rising edge 01: TB2IN0 TB2IN1 INT1 occurs at rising edge 10: TB2IN0 TB2IN0 INT1 occurs at falling edge 11: TA1OUT TA1OUT INT1 occurs at rising edge
TMRB2 input clock select 00: TB2IN0 pin input 01: T1 10: T4 11: T16 TB2FF0C1 TB2FF0C0
TB2FF1C1
TB2FF1C0
TB2C1T1
TB2C0T1 R/W
TB2E1T1
W* 1 TB2FFCR 16-bit timer frip-flop control 1A3H
(RMW instructions are prohibited.)
W* 0 0 1 1
1
0
0
TB2FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB2FF0 inversion trigger 0: Disable 1: Enable
Invert when UC2 is loaded into TB2CP1H/L. Invert when UC2 is loaded into TB2CP0H/L. Invert when UC2 matches TB2RG1H/L. Invert when UC2 matches TB2RG0H/L.
TB2FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB2RG0L
16-bit timer register 0L 16-bit timer register 0H 16-bit timer register 1L 16-bit timer register 1H
1A8H
(RMW instructions are prohibited.)
- W Undefined - W Undefined - W Undefined - W Undefined -
1A9H
(RMW instructions are prohibited.)
TB2RG0H
1AAH
(RMW instructions are prohibited.)
TB2RG1L
1ABH
(RMW instructions are prohibited.)
TB2RG1H
TB2CP0L
Capture register 0L
1ACH
R Undefined -
TB2CP0H
Capture register 0H
1ADH
R Undefined -
TB2CP1L
Capture register 1L
1AEH
R Undefined -
TB2CP1H
Capture register 1H
1AFH
R Undefined
Page 272
2007-10-10
TMP91FU62
Symbol
Name
Address
7 TB3RDE R/W
6 -
5 - -
4 - - -
3 I2TB3
2 TB3PRUN R/W
1 - -
0 TB3RUN R/W 0 Up counter (UC3)
TB3RUN
16-bit timer control
0 1B0H Double Buffer 0: Disable 1: Enable TB3CT1 R/W
0
-
0 IDLE2 0: Stop 1: Operate TB3CPM0
0 TMRB3 prescaler 0: Stop and Clear 1: Run (count up) TB3CLE R/W
- -
Always write 0.
-
-
TB3ET1
TB3CP0I W*
TB3CPM1
TB3CLK1
TB3CLK0
TB3MOD
16-bit timer source CLK & mode
0 1B2H
(RMW instructions are prohibited.) Invert when UC3 is loaded into TB3CP1H/L
0
1
Software capture control 0: Software capture 1: Undefined
0
0
0 Up counter control 0: Clear disable 1: Clear enable TB3E0T1
0
0
TB3FF1 inversion trigger 0: Trigger disable 1: Trigger enable
Invert when UC3 matches with TB3RG1H/L
Capture timing 00: Disable INT3 occurs at rising edge 01: TB3IN0 TB3IN1 INT3 occurs at rising edge 10: TB3IN0 TB3IN0 INT3 occurs at falling edge 11: Reserved
TMRB3 input clock select 00: TB3IN0 pin input 01: T1 10: T4 11: T16 TB3FF0C1 TB3FF0C0
TB3FF1C1
TB3FF1C0
TB3C1T1
TB3C0T1 R/W
TB3E1T1
W* 1 TB3FFCR 16-bit timer frip-flop control 1B3H
(RMW instructions are prohibited.)
W* 0 0 1 1
1
0
0
TB3FF1 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB3FF0 inversion trigger 0: Disable 1: Enable
Invert when UC3 is loaded into TB3CP1H/L. Invert when UC3 is loaded into TB3CP0H/L. Invert when UC3 matches TB3RG1H/L. Invert when UC3 matches TB3RG0H/L.
TB3FF0 control 00: Invert 01: Set 10: Clear 11: Don't care Note: Always read as 11.
TB3RG0L
16-bit timer register 0L 16-bit timer register 0H 16-bit timer register 1L 16-bit timer register 1H
1B8H
(RMW instructions are prohibited.)
- W Undefined - W Undefined - W Undefined - W Undefined -
1B9H
(RMW instructions are prohibited.)
TB3RG0H
1BAH
(RMW instructions are prohibited.)
TB3RG1L
1BBH
(RMW instructions are prohibited.)
TB3RG1H
TB3CP0L
Capture register 0L
1BCH
R Undefined -
TB3CP0H
Capture register 0H
1BDH
R Undefined -
TB3CP1L
Capture register 1L
1BEH
R Undefined -
TB3CP1H
Capture register 1H
1BFH
R Undefined
Page 273
2007-10-10
TMP91FU62
(7) UART/SIO
Symbol Name Serial channel 0 buffer Address 200H
(RMW instructions are prohibited.)
7 RB7 / TB7
6 RB6 / TB6
5 RB5 / TB5
4 RB4 / TB4
3 RB3 / TB3
2 RB2 / TB2
1 RB1 / TB1
0 RB0 / TB0
SC0BUF
R (Receiving) / W (Transmission) Undefined RB8 R Undefined 0 EVEN R/W 0 PE OERR PERR FERR SCLKS R/W 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC1 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC0 IOC
R (Cleared to "0" when read) 0 Overrun error flag 0: Undetect error 1: Detect error WU R/W 0 Parity error flag 0: Undetect error 1: Detect error SM1 0 Framing error flag 0: Undetect error 1: Detect error SM0
SC0CR
Serial channel 0 control
201H
(RMW instructions are prohibited.)
Received data bit8
Parity 0: Odd 1: Even
Parity addition 0: Disable 1: Enable
TB8
CTSE
RXE
0 SC0MOD0 Serial channel 0 mode 0 202H Transmission data bit8
0
0
0
0
0
0
0
Handshake function 0: Disable 1: Enable
Receive function 0: Disable 1: Enable
Wakeup function 0: Disable 1: Enable
Serial transmission mode 00: I/O interface mode 01: 7-bit UART mode 10: 8-bit UART mode 11: 9-bit UART mode BR0S3 R/W BR0S2
Serial transmission clock (UART) 00: Timer TA0TRG 01: Baud rate generator 10: Internal clock fSYS 11: External clock (SCLK input) BR0S1 BR0S0
-
BR0ADDE
BR0CK1
BR0CK0
0 BR0CR Baud ratel control 203H Always write 0.
0
0
0
0
0
0
0
+ (16 - K)/ 16 division 0: Disable 1: Enable
Input clock selection for baud rate generator 00: T0 01: T2 10: T8 11: T32 - - - - - - - - - - - - - - - - 0
Setting of the divided frequency "N"
- Serial channel 0 K setting register - 204H - - I2S0 R/W SC0MOD1 Serial channel 0 mode 1 205H 0 IDLE2 0: Stop 1: Run
- - - - FDPX0
BR0K3
BR0K2 R/W 0
BR0K1
BR0K0
BR0ADD
0
0
Sets frequency divisor "K" (Divided by N + (16 - K)/16) - - - - - - - - -
0 Duplex 0: Half 1: Full
-
-
-
-
-
-
-
Page 274
2007-10-10
TMP91FU62
Symbol
Name Serial channel 1 buffer
Address 208H
(RMW instructions are prohibited.)
7 RB7 / TB7
6 RB6 / TB6
5 RB5 / TB5
4 RB4 / TB4
3 RB3 / TB3
2 RB2 / TB2
1 RB1 / TB1
0 RB0 / TB0
SC1BUF
R (Receiving) / W (Transmission) Undefined RB8 R Undefined 0 EVEN R/W 0 PE OERR PERR FERR SCLKS R/W 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC1 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC0 IOC
R (Cleared to "0" when read) 0 Overrun error flag 0: Undetect error 1: Detect error WU R/W 0 Parity error flag 0: Undetect error 1: Detect error SM1 0 Framing error flag 0: Undetect error 1: Detect error SM0
SC1CR
Serial channel 1 control
209H
(RMW instructions are prohibited.)
Received data bit8
Parity 0: Odd 1: Even
Parity addition 0: Disable 1: Enable
TB8
CTSE
RXE
0 SC1MOD0 Serial channel 1 mode 0 20AH Transmission data bit8
0
0
0
0
0
0
0
Handshake function 0: Disable 1: Enable
Receive function 0: Disable 1: Enable
Wakeup function 0: Disable 1: Enable
Serial transmission mode 00: I/O interface mode 01: 7-bit UART mode 10: 8-bit UART mode 11: 9-bit UART mode BR1S3 R/W BR1S2
Serial transmission clock (UART) 00: Timer TA0TRG 01: Baud rate generator 10: Internal clock fSYS 11: External clock (SCLK input) BR1S1 BR1S0
-
BR1ADDE
BR1CK1
BR1CK0
0 BR1CR Baud ratel control 20BH Always write "0".
0
0
0
0
0
0
0
+ (16 - K)/ 16 division 0: Disable 1: Enable
Input clock selection for baud rate generator 00: T0 01: T2 10: T8 11: T32 - - - - - - - - - - - - - - - - 0
Setting of the divided frequency "N"
- Serial channel 1 K setting register - 20CH - - I2S1 R/W SC1MOD1 Serial channel 1 mode 1 20DH 0 IDLE2 0: Stop 1: Run
- - - - FDPX1
BR1K3
BR1K2 R/W 0
BR1K1
BR1K0
BR1ADD
0
0
Sets frequency divisor "K" (Divided by N + (16 - K)/16) - - - - - - - - -
0 Duplex 0: Half 1: Full
-
-
-
-
-
-
-
Page 275
2007-10-10
TMP91FU62
Symbol
Name Serial channel 2 buffer
Address 210H
(RMW instructions are prohibited.)
7 RB7 / TB7
6 RB6 / TB6
5 RB5 / TB5
4 RB4 / TB4
3 RB3 / TB3
2 RB2 / TB2
1 RB1 / TB1
0 RB0 / TB0
SC2BUF
R (Receiving) / W (Transmission) Undefined RB8 R Undefined 0 EVEN R/W 0 PE OERR PERR FERR SCLKS R/W 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC1 0 Edge selection for SCLK pin (I/O mode) 0: SCLK 1: SCLK SC0 IOC
R (Cleared to "0" when read) 0 Overrun error flag 0: Undetect error 1: Detect error WU R/W 0 Parity error flag 0: Undetect error 1: Detect error SM1 0 Framing error flag 0: Undetect error 1: Detect error SM0
SC2CR
Serial channel 2 control
211H
(RMW instructions are prohibited.)
Received data bit8
Parity 0: Odd 1: Even
Parity addition 0: Disable 1: Enable
TB8
CTSE
RXE
0 SC2MOD0 Serial channel 2 mode 0 212H Transmission data bit8
0
0
0
0
0
0
0
Handshake function 0: Disable 1: Enable
Receive function 0: Disable 1: Enable
Wakeup function 0: Disable 1: Enable
Serial transmission mode 00: I/O interface mode 01: 7-bit UART mode 10: 8-bit UART mode 11: 9-bit UART mode BR2S3 R/W BR2S2
Serial transmission clock (UART) 00: Timer TA0TRG 01: Baud rate generator 10: Internal clock fSYS 11: External clock (SCLK input) BR2S1 BR2S0
-
BR2ADDE
BR2CK1
BR2CK0
0 BR2CR Baud ratel control 213H Always write "0".
0
0
0
0
0
0
0
+ (16 - K)/ 16 division 0: Disable 1: Enable
Input clock selection for baud rate generator 00: T0 01: T2 10: T8 11: T32 - - - - - - - - - - - - - - - - 0
Setting of the divided frequency "N"
- Serial channel 2 K setting register - 214H - - I2S2 R/W SC2MOD1 Serial channel 2 mode 1 215H 0 IDLE2 0: Stop 1: Run
- - - - FDPX2
BR2K3
BR2K2 R/W 0
BR2K1
BR2K0
BR2ADD
0
0
Sets frequency divisor "K" (Divided by N + (16 - K)/16) - - - - - - - - -
0 Duplex 0: Half 1: Full
-
-
-
-
-
-
-
Page 276
2007-10-10
TMP91FU62
(8) I2C bus interface
Symbol Name Address 7 BC2 6 BC1 W Serial bus interface control register 1 240H
(RMW instructions are prohibited.)
5 BC0
4 ACK R/W
3 - - -
2 SCK2 W 0
1 SCK1
0 SCK0/ SWRMON R/W
0
0
0
0
0
0/1
SBI0CR1
Number of transferred bits 000: 8 001: 1 010: 2 011: 3 100: 4 101: 5 110: 6 111: 7
Acknowledge clock 0: Disable 1: Enable
-
at write Internal serial clock selection and software reset monitor 000: 4 001: 5 010: 6 011: 7 100: 8 101: 9 110: 10 111:Reserved at read 0: During software reset DB2 DB1 DB0
SBI0DBR
SBI buffer register
241H
(RMW instructions are prohibited.)
DB7
DB6
DB5
DB4
DB3
R (Receiving) / W (Transmission) Undefined SA6 SA5 SA4 SA3 W SA2 SA1 SA0 ALS
I2C0AR
I2C bus address register
242H
(RMW instructions are prohibited.)
0
0
0
0
0
0
0
0 Address recognition 0: Enable 1: Disable
Slave address selection for when device is operating as slave device
MST
TRX
BB
PIN R/W
AL/ SBIM1
AAS/ SBIM0
AD0/ SWRST1
LRB/ SWRST0
When read SBI0SR
Serial bus interface status register 243H
(RMW instructions are prohibited.)
0
0
0
1 INTSBI request monitor 0: Request 1: Cancel
0 Arbitration lost detection monitor 1: Detect
0 Slave address match detection monitor 1:Detect
0
0 Last receive bit monitor 0: "0" 1: "1"
Bus status monitor 0: Free 1: Busy[ 0: Slave 1: Master 0:Receiver 1:Transmit
GENERAL CALL detection 1: Detect
When write SBI0CR2
Serial bus interface control register 2
Start/stop condition 0: Start condition 1: Stop condition - - -
Cancel INTSBI interrupt request 0: - 1: Cancel - - -
Serial bus interface operating mode selection 00: Port mode 01: Reserved 10: I2C bus mode 11: Reserved - - - - - -
Software reset generate Write "10" and "01", then an internal reset signal is generated.
- W Serial bus interface baud rate register 244H
(RMW instructions are prohibited.)
I2SBI0 R/W 0 Operation in IDLE2 mode 0: Stop 1: Operate -
- - -
- R/W 0
0
SBI0BR
Always write "0"
-
-
-
-
-
Always write "0"
SBI0EN R/W SBI0CR0 Serial bus interface control register 0 247H
(RMW instructions are prohibited.)
-
-
- R
-
-
-
0 SBI operation 0: disable 1: enable
0
0
0
0
0
0
0
Always read "0".
Page 277
2007-10-10
TMP91FU62
(9) AD converter
Symbol Name Address 7 ADRS 6 AMD 5 4 AINEN R/W 0 ADCCR1 AD control register 1 2B0H AD conversion start 0: 1: AD conversion start EOCF R 0 AD control register 2 2B1H
(RMW instructions are prohibited.)
3
2 SAIN
1
0
0
0
0
0
0
0
0
AD operating mode 00: AD operation disable 01: single mode 10: Reserved 11: Repeat mode ADBF RSEL
Analog input control 0: disable 1: enable
Analog input channel select 0000: AN0 0100: AN4 1000: AN8 1100: AN12 0001: AN1 0101: AN5 1001: AN9 1101: AN13 0010: AN2 0110: AN6 1010: AN10 1110: AN14 0011: AN3 0111: AN7 1011: AN11 1111: AN15
I2AD R/W
ACK
0 AD conversion BUSY flag 0: During stop of AD conversion 1: During AD conversion AD06
0 Storing of an AD conversion result 0: 10bit mode 1: 8bit mode AD05
0
1
1
0
0
ADCCR2
AD conversion end flag 0:Before or during conversion 1: Conversion completed AD07
AD conversion time select IDLE2 control 0:Stop 1:Operation 1010: 78 / fc [s] 1011: 156 / fc [s] 1100: 312 / fc [s] 1101: 624 / fc [s] 1110: 1248 / fc [s]
ADCDRL
AD result register L
AD04 R
AD03
AD02
AD01
AD00
2B2H 0 - 0 - 0 - 0 -
0 - R
0 -
0 AD09
0 AD08
ADCDRH When 10-bit storing mode ADCDRH When 8-bit storing mode
AD result register H
0 2B3H AD09
0 AD08
0 AD07
0 AD06 R
0 AD05
0 AD04
0 AD03
0 AD02
0
0
0
0
0
0
0
0
Page 278
2007-10-10
TMP91FU62
(10) Watchdog timer
Symbol Name Address 7 WDTE 6 WDTP1 R/W 0 WDMOD WDT mode register 300H WDT control 1: Enable 0 0 5 WDTP0 4 - - - 3 - - - 0 2 I2WDT 1 RESCR R/W 0 1: Intermally connects WDT out to the reset pin 0 0 -
Select detecting time 00: 215/fSYS 01: 217/fSYS 10: 219/fSYS 11: 221/fSYS - - - IDLE2 0: Stop 1: Operate
Always write "0".
301H WDCR WDT control
(RMW instructions are prohibited.)
W - B1H: WDT disable code 4EH: WDT clear code
(11) Special timer for CLOCK
Symbol Name Address 7 - R/W RTC control register 0 310H Always write "0". - - - - 6 - - - 5 - - - 4 - - - 3 - - - 0 00: 2 /fs 01: 213/fs 10: 212/fs 11: 211/fs 0: Stop & clear 1: Count
14
2 RTCSEL1
1 RTCSEL0 R/W 0
0 RTCRUN
0
RTCCR
Page 279
2007-10-10
TMP91FU62
(12) Program patch logic
Symbol Name Address 400H
(RMW instructions are prohibited.)
7 ROMC07
6 ROMC06
5 ROMC05
4 ROMC04 W
3 ROMC03
2 ROMC02
1 ROMC01
0 - -
ROMCMP00
Address compare register 00
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP01 Address compare register 01 401H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP02 Address compare register 02 402H
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB0L Address substitution register 0L 404H
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB0H Address substitution register 0H 405H
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits) ROMC07 ROMCMP10 Address compare register 10 408H
(RMW instructions are prohibited.)
ROMC06
ROMC05
ROMC04 W
ROMC03
ROMC02
ROMC01
- -
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP11 Address compare register 11 409H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP12 Address compare register 12 40AH
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB1L Address substitution register 1L 40CH
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB1H Address substitution register 1H 40DH
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits)
Page 280
2007-10-10
TMP91FU62
Symbol
Name
Address 410H
(RMW instructions are prohibited.)
7 ROMC07
6 ROMC06
5 ROMC05
4 ROMC04 W
3 ROMC03
2 ROMC02
1 ROMC01
0 - -
ROMCMP20
Address compare register 20
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP21 Address compare register 21 411H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP22 Address compare register 22 412H
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB2L Address substitution register 2L 414H
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB2H Address substitution register 2H 415H
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits) ROMC07 ROMCMP30 Address compare register 30 418H
(RMW instructions are prohibited.)
ROMC06
ROMC05
ROMC04 W
ROMC03
ROMC02
ROMC01
- -
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP31 Address compare register 31 419H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP32 Address compare register 32 41AH
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB3L Address substitution register 3L 41CH
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB3H Address substitution register 3H 41DH
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits)
Page 281
2007-10-10
TMP91FU62
Symbol
Name
Address 420H
(RMW instructions are prohibited.)
7 ROMC07
6 ROMC06
5 ROMC05
4 ROMC04 W
3 ROMC03
2 ROMC02
1 ROMC01
0 - -
ROMCMP40
Address compare register 40
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP41 Address compare register 41 421H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP42 Address compare register 22 422H
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB4L Address substitution register 4L 424H
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB4H Address substitution register 4H 425H
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits) ROMC07 ROMCMP50 Address compare register 50 428H
(RMW instructions are prohibited.)
ROMC06
ROMC05
ROMC04 W
ROMC03
ROMC02
ROMC01
- -
0
0
0
0
0
0
0
- -
Target ROM address (Lower 7 bits) ROMC15 ROMCMP51 Address compare register 51 429H
(RMW instructions are prohibited.)
ROMC14
ROMC13
ROMC12 W
ROMC11
ROMC10
ROMC09
ROMC08
0
0
0
0
0
0
0
0
Target ROM address (Middle 8 bits) ROMC23 ROMCMP52 Address compare register 52 42AH
(RMW instructions are prohibited.)
ROMC22
ROMC21
ROMC20 W
ROMC19
ROMC18
ROMC17
ROMC16
0
0
0
0
0
0
0
0
Target ROM address (Upper 8 bits) ROMS07 ROMSUB5L Address substitution register 5L 42CH
(RMW instructions are prohibited.)
ROMS06
ROMS05
ROMS04 W
ROMS03
ROMS02
ROMS01
ROMS00
0
0
0
0
0
0
0
0
Patch code (Lower 8 bits) ROMS15 ROMSUB5H Address substitution register 5H 42DH
(RMW instructions are prohibited.)
ROMS14
ROMS13
ROMS12 W
ROMS11
ROMS10
ROMS09
ROMS08
0
0
0
0
0
0
0
0
Patch code (Upper 8 bits)
Page 282
2007-10-10
TMP91FU62
16. I/O Port Equivalent-circuit Diagrams
* How to read circuit diagrams The circuit diagrams in this chapter are drawn using the same gate symbols as for the 74HCxx series standard CMOS logic ICs. The signal named STOP has a unique function. This signal goes active-high if the CPU sets the HALT bit when the HALTM[1:0] field in the SYSCR2 register is programmed to 01 (e.g., STOP mode) and the drive enable (DRVE) bit in the same register is cleared. If the DRVE bit is set, the STOP signal remains inactive (at logic 0). * The input protection circuit has a resistor in the range of several tens to several hundreds of ohms.
16.1 Equivalent circuit Diagrams
1. P0, P1
VCC P-ch
STOP
N-ch
2. P5 (AN0 to AN7), P6 (AN8 to AN15)
VCC P-ch
STOP
N-ch
3. P40(SCOUT), P41(TXD2), P42(RXD2), P43(SCLK2/CTS2)
Vcc
P-ch
Vcc STOP
N-ch
Page 283
2007-10-10
TMP91FU62
4. P75 (INT0)
Vcc
P-ch
STOP
N-ch
5. P32(WAIT/TB3OUT0), P33(TB3OUT1), P70(TA0IN), P71(TA1OUT), P72, P73(TA4IN), P74(TA5OUT), P80 to P87, P91(RXD0), P92(SCLK0/CTS0), P94(RXD1), P95(SCLK1/CTS1), PA0 to PA3, PB0 to PB2
VCC P-ch
STOP
N-ch
6. P30(TB3IN0/INT3/SDA0), P31(TB3IN1/INT4/SCL0), P90(TXD0), P93(TXD1)
Vcc
P-ch
N-ch
STOP
7. P96 (XT1), P97 (XT2)
Vcc
P-ch
P97(XT2)
N-ch
Vcc
P-ch
P96(XT1)
N-ch
STOP
Page 284
2007-10-10
TMP91FU62
8. AM0 to AM1
9. RESET
Vcc P-ch
WDTOUT
10. X1, X2
X2 P-ch N-ch
X1
11. AVCC, AVSS
VREFON P-ch AVCC
AVSS
Page 285
2007-10-10
TMP91FU62
17. Points to Note and Restrictions
17.1 Notation
a. The notation for built-in I/O registers is as follows register symbol e.g.) TA01RUN denotes bit TA0RUN of register TA01RUN. b. Read-modify-write instructions An instruction in which the CPU reads data from memory and writes the data to the same memory location in one instruction. Example 1: Example 2: SET INC 3, (TA01RUN) ... Set bit3 of TA01RUN. 1, (100H) ... Increment the data at 100H.
*Examples of read-modify-write instructions on the TLCS-900 Exchange instruction EX (mem), R
Arithmetic operations ADD SUB INC (mem), R/# (mem), R/# #3, (mem) ADC SBC DEC (mem), R/# (mem), R/# #3, (mem)
Logic operations AND XOR (mem), R/# (mem), R/# OR (mem), R/#
Bit manipulation operations STCF SET TSET #3/A, (mem) #3, (mem) #3, (mem) RES CHG #3, (mem) #3, (mem)
Rotate and shift operations RLC RL SLA SLL RLD (mem) (mem) (mem) (mem) (mem) RRC RR SRA SRL RRD (mem) (mem) (mem) (mem) (mem)
c. fOSCH, fc, fs, fFPH, fSYS and one state The clock frequency input on pins X1 and 2 is called fOSCH or fc. The clock selected by SYSCR1 is called fFPH. The clock frequency give by fFPH divided by 2 is called fSYS. One cycle of fSYS is referred to as one state.
Page 286
2007-10-10
TMP91FU62
17.2 Points of note
a. AM0 and AM1 pins This pin is connected to the DVcc pin. Do not alter the level when the pin is active. b. EMU0 pins Open pins. c. HALT mode (IDLE1) When IDLE1 mode (in which oscillator operation only occurs) is used, set RTCCR to 0 stop the Special timer for CLOCK before the HALT instructions is executed. d. Warm-up counter The warm-up counter operates when STOP mode is released, even if the system is using an external oscillator. As a result a time equivalent to the warm-up time elapses between input of the release request and output of the system clock. e. Programmable pull-up/pull-down resistances The programmable pull-up/pull-down resistor can be turned ON/OFF by a program when the ports are set for use as input ports. When the ports are set for use as output prts, they cannot be turned ON/OFF by a program. The data registers (e.g., P4) are used to turn the pull-up/pull-down resistors ON/OFF. Consequently read-modify-write instructions are prohibited. f. Watchdog timer The watchdog timer starts operation immediately after a reset is released. When the watchdog timer is not to be used, disable it. When the bus is released, neither internal memory nor internal I/O can be accessed. However, the internal I/O continues to operate. Hence the watchdog timer continues to run. Therefore be careful about the bus releasing time and set the detection timer of watchdog timer. g. CPU (Micro DMA) Only the LCD cr, r and LDC r, cr instructions can be used to access the control registers in the CPU (e.g., the transfer source address register (DMASn)). h. Undefined SFR The value of an undefined bit in an SFR is undefined when read. i. POP SR instruction Please execute the POP SR instruction during DI condition. j. Clocks for serial channels (SIO) As for the serial channels SIO0, SIO1 and SIO2, a baud rate generator is unavailable as an input clock of an I/O interface and a clock for a serial transfer if a prescaler clock is set to fc/16 when SYSCR0 is "1".
Page 287
2007-10-10
TMP91FU62
18. Package Dimension
LQFP80-P-1212-0.50E
Unit: mm
60 61
41 40
80 20 1.25 TYP. 0.5
21
0.22 0.05
0.08
Page 288
2007-10-10
TMP91FU62
QFP80-P-1420-0.80B
Unit: mm
Page 289
2007-10-10
Postscript
This is a technical document that describes the operating functions and electrical specifications of the 16bit microcontroller series TLCS-900/L1 (LSI). Toshiba provides a variety of development tools and basic software to enable efficient software development. These development tools have specifications that support advances in microcomputer hardware (LSI) and can be used extensively. Both the hardware and software are supported continuously with version updates. The recent advances in CMOS LSI production technology have been phenomenal and microcomputer systems for LSI design are constantly being improved. The products described in this document may also be revised in the future. Be sure to check the latest specifications before using. Toshiba is developing highly integrated, high-performance microcomputers using advanced MOS production technology and especially well proven CMOS technology. We are prepared to meet the requests for custom packaging for a variety of application areas. We are confident that our products can satisfy your application needs now and in the future.


▲Up To Search▲   

 
Price & Availability of TMP91FU62FG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X